安装
安装 Docker
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
sudo curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository -y "deb [arch=$(dpkg --print-architecture)] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl start docker
sudo systemctl enable docker
国内源
cat << EOF | sudo tee /etc/docker/daemon.json
{
"registry-mirrors":[
"https://hub-mirror.c.163.com",
"https://mirror.baidubce.com",
"https://qby02i3s.mirror.aliyuncs.com",
"https://docker.mirrors.ustc.edu.cn"
],
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
授权普通用户
添加非安全镜像仓库
vim /etc/docker/daemon.json