docker-ce_install_ubuntu18
docker-ce_install_ubuntu18
1.docker-ce 在线安装
1.1.卸载旧版软件
apt-get remove docker docker-engine docker.io containerd runc -y
1.2.配置仓库
- 更新软件,安装依赖库文件
sudo apt-get update -y
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
- 安装 GPG 证书,配置软件仓库
# 官方源
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# 可选:阿里云源
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
# 可选:清华源
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
- 参考地址:
https://developer.aliyun.com/mirror/docker-ce?spm=a2c6h.13651102.0.0.3e221b11ncDNOT
- 实例演示:
root@zuiyoujie :~# sudo apt-key fingerprint 0EBFCD88
pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) <docker@docker.com>
sub rsa4096 2017-02-22 [S]
1.3.安装 docker-ce
- 安装最新版
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io -y
- 安装指定的版本 docker-ce
# 查看版本列表:
apt-cache madison docker-ce
# 安装指定版本:
sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
# 命令示例:
sudo apt-get install docker-ce=5:19.03.3~3-0~ubuntu-bionic docker-ce-cli=5:19.03.3~3-0~ubuntu-bionic containerd.io
- 版本升级
sudo apt-get update
1.4.测试是否安装成功
- ubuntu 安装完毕默认会自动启动
sudo docker run hello-world
2.离线安装 docker-ce
- 优点:提前下载,在大批量集群初始化安装时可以保证版本一致性,安装速度与成功率
2.1.软件下载
# 版本列表
https://download.docker.com/linux/ubuntu/dists/
https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/
# 软件下载地址
https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/docker-ce_19.03.5~3-0~ubuntu-bionic_amd64.deb
https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/docker-ce-cli_19.03.5~3-0~ubuntu-bionic_amd64.deb
https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/containerd.io_1.2.6-3_amd64.deb
2.2.安装软件
- 将下载好的软件包上传到服务器中进行安装
mkdir -p /opt/tools
cd /opt/tools
sudo dpkg -i /path/to/package.deb
sudo dpkg -i docker-ce_19.03.5~3-0~ubuntu-bionic_amd64.deb docker-ce-cli_19.03.5~3-0~ubuntu-bionic_amd64.deb containerd.io_1.2.6-3_amd64.deb
2.3.测试安装的 docker-ce
sudo docker run hello-world
3.卸载 docker 软件
sudo apt-get purge docker-ce docker-ce-cli containerd.io
sudo rm -rf /var/lib/docker
END
作者:天生帅才 www.zuiyoujie.com
本文版权归作者和博客园共有,如果感觉有用可以随意打赏,感谢支持,欢迎转载