-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker_install.txt
41 lines (30 loc) · 1.03 KB
/
docker_install.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
//此处需要proxy
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce
//安装完成 查看docker状态
sudo systemctl status docker
//开机自启
sudo systemctl enable docker
//换源
sudo vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://docker.1panelproxy.com"]
}
sudo systemctl restart docker
//代理
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo nano /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://192.168.228.1:10811"
Environment="HTTPS_PROXY=http://192.168.228.1:10811"
Environment="NO_PROXY=localhost,127.0.0.1"
sudo systemctl daemon-reload
sudo systemctl restart docker
//使当前用户不需sudo使用docker
sudo usermod -aG docker $(whoami)
//重启生效
sudo reboot now