系统相关
首页 > 系统相关> > Ubuntu20下载安装Docker

Ubuntu20下载安装Docker

作者:互联网

安装Docker

sudo apt-get remove docker \
               docker-engine \
               docker.io
sudo apt-get update

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo systemctl enable docker
sudo systemctl start docker
sudo groupadd docker #添加docker组
sudo usermod -aG docker $USER #将当前用户加入docker组
docker run --rm hello-world

重要:设置Docker镜像加速

systemctl cat docker | grep '\-\-registry\-mirror'
{
  "registry-mirrors": [
    "https://docker.mirrors.ustc.edu.cn",
    "https://hub-mirror.c.163.com",
    "https://mirror.baidubce.com"
  ]
}
sudo systemctl daemon-reload
sudo systemctl restart docker
Registry Mirrors:
 https://hub-mirror.c.163.com/

卸载Docker

sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

标签:https,get,sudo,apt,下载安装,Docker,Ubuntu20,docker
来源: https://www.cnblogs.com/cs-code/p/16614483.html