Skip to content

[Ubuntu20] 安装docker

bash


sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg
 

 curl -fsSL https://download.docker.com/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.ustc.edu.cn/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

sudo systemctl start docker

# 添加docker可启动用户,重登陆有效
sudo groupadd docker
sudo usermod -aG docker $USER