ubuntu系统安装docker
系统版本:Ubuntu 18.04
# 更新
apt update

# 安装依赖
apt install apt-transport-https ca-certificates curl software-properties-common -y

# 添加 key
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add -

# 添加 Docker 源
add-apt-repository \
"deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \
$(lsb_release -cs) \
stable"

# 更新
apt update

# 安装 Docker
apt install docker-ce -y

# 重启daemon:
systemctl daemon-reload
# 重启docker服务:
systemctl restart docker
# 开机自启动:
systemctl enable docker

# 测试运行:
sudo docker run hello-world

# 查看docker版本号

# 添加当前用户到 docker 用户组,可以不用 sudo 运行 docker(可选):
sudo groupadd docker
sudo usermod -aG docker $USER

# 测试添加用户组(可选):
docker run hello-world


浙公网安备 33010602011771号