前置要求
1.卸载旧版本docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2.在可以联网的机器上下载docker组件
2.1.下载依赖组件
wget http://mirror.centos.org/altarch/7/extras/aarch64/Packages/container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm
wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.2-3.3.el7.x86_64.rpm
wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-cli-19.03.9-3.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libcgroup-0.41-21.el7.x86_64.rpm
2.2.安装依赖组件
将下载好的依赖组件上传到要安装docker的服务器中,如下是要安装的依赖组件。
container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm
containerd.io-1.2.2-3.3.el7.x86_64.rpm
docker-ce-cli-19.03.9-3.el7.x86_64.rpm
2.3.开始安装依赖组件
rpm -Uvh *.rpm --nodeps --force
3.下载docker安装文件
wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-19.03.9-3.el7.x86_64.rpm
4.下载docker-compose
wget https://github.com/docker/compose/releases/download/1.28.2/docker-compose-Linux-x86_64
2.开始安装Docker
rpm -ivh docker-ce-19.03.9-3.el7.x86_64.rpm
2.1启动Docker
# 启动
systemctl start docker
# 查看状态
systemctl status docker
# docker 开机启动
systemctl enable docker
3.安装docker-compose
3.1.上传docker-compose-Linux-x86_64文件到服务器中
chmod +x docker-compose-Linux-x86_64 && mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
3.2.配置profile环境变量(可选)
如果已经配置了环境变量可以略过此步骤。
vi /etc/profile
#添加如下内容
export PATH=$PATH/usr/local/bin
加载配置使配置生效
source /etc/profile
3.3.测试是否成功
docker-compose --version
4.卸载docker
4.1.查看docker安装包
yum list installed | grep docker
4.2.卸载docker
yum remove docker*
4.3.删除镜像或容器等数据
rm -rf /var/lib/docke
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。