1、docker安装

  1. 如果本地之前安装过docker版本,需要先卸载
    yum -y remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine

[root@s8]# rpm -qa | grep docker
docker-ce-cli-20.10.6-3.el7.x86_64
docker-scan-plugin-0.7.0-3.el7.x86_64
[root@s8]# rpm -e --nodeps docker-ce-cli-20.10.6-3.el7.x86_64
[root@s8]# rpm -e --nodeps docker-scan-plugin-0.7.0-3.el7.x86_64

  1. 添加软件源信息
    yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

如果没有yum-config-manager命令,用yum provides查看需要安装哪个包yum-utils

[root@dwl-test1 system]# yum provides yum-config-manager
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
yum-utils-1.1.31-54.el7_8.noarch : Utilities based around the yum package manager

然后 yum -y install yum-utils即可

  1. 安装所需版本的docker

查看支持版本

yum list docker-ce --showduplicates | sort -r

安装指定版本

yum -y install docker-ce-20.10.17-3.el7

4) 查看是否安装成功
yum list installed | grep docker

5)docker操作指令
systemctl start docker
systemctl stop docker
systemctl status docker

  1. 配置docker客户端
    vim /etc/docker/daemon.json
    {
    “registry-mirrors”: [“https://py5jxobw.mirror.aliyuncs.com”],
    “insecure-registries”: [“test.12345.com:5000”] ##此处也可以设置私人镜像仓库地址
    }
    systemctl daemon-reload
    systemctl restart docker

2、docker-compose安装
官方下载地址:https://github.com/docker/compose/releases/tag/1.29.2
wget 下载该包到服务器

mv /home/work/init/docker-compose-Linux-x86_64 /usr/local/bin/docker-compose

chmod +x /usr/local/bin/docker-compose

创建软链

ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

验证查看docker-compose版本

docker-compose --version

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐