debian,ubuntu安装docker 系统软件 docker



#debian, ubuntu

# 安装通过 HTTPS 添加新存储库所需的软件包:

apt update

apt install -y apt-transport-https ca-certificates curl software-properties-common gnupg2


# 导入存储库的 GPG 密钥, 成功后,命令将返回 OK 。

curl -fsSL https://download.docker.com/linux/debian/gpg |  sudo apt-key add -

-国内

curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/debian/gpg | sudo apt-key add -


# 将 Docker APT 存储库添加到系统的软件存储库列表中

add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

---$(lsb_release -cs) 将返回 Debian 发行版的名称。在这个例子总,返回的就是 buster 。

-国内

add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/debian $(lsb_release -cs) stable"


# 使用新添加的repo中的Docker包更新包数据库

apt update


# 确保您要从Docker repo而不是默认的Debian repo安装

apt-cache policy docker-ce  


# 安装

apt install -y docker-ce    docker-ce-cli containerd.io  docker-compose-plugin docker-ce-rootless-extras docker-buildx-plugin


# 查找Docker-CE的版本:

apt-cache madison docker-ce

#   docker-ce | 17.03.1~ce-0~ubuntu-xenial | https://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages

# 安装指定版本的Docker-CE: (VERSION例如上面的17.03.1~ce-0~ubuntu-xenial)

apt-get -y install docker-ce=[VERSION]


# 验证

systemctl status docker


#ubuntu

sudo curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

sudo usermod -aG docker ubuntu


签名:这个人很懒,什么也没有留下!
最新回复 (0)
返回