安装
Step. 1 更新软件存储库
sudo apt-get update
sudo apt install docker.io
Step. 2 卸载旧版本的Docker
sudo apt-get remove docker docker-engine docker.io
Step. 3 安装Docker
sudo apt-get install docker.io
Step. 4 启动
sudo systemctl start docker
sudo systemctl enable docker
Step. 5 增加用户到docker组
sudo gpasswd -a ${USER} docker
OR
sudo usermod -aG docker ${USER}
sudo service docker restart
chmod 666 /var/run/docker.sock
更换源
[1]
vi /etc/docker/daemon.json
[2]
{
"registry-mirrors": [
"https://s3d612fh.mirror.aliyuncs.com",
"https://docker.mirrors.ustc.edu.cn",
"https://registry.docker-cn.com"
]
}
[3]
sudo systemctl daemon-reload
sudo systemctl restart docker
docker使用代理
sudo vim /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=localhost:7890"
Environment="HTTPS_PROXY=localhost:7890"
重启
sudo systemctl daemon-reload
sudo systemctl restart docker