安装 Docker 19.03.12

young依然 2020-07-19

安装docker 19.03.12

目录

1:物理环境

本机环境:Centos7.7

为了环境的纯净卸载老版本

yum remove docker                   docker-client                   docker-client-latest                   docker-common                   docker-latest                   docker-latest-logrotate                   docker-logrotate                   docker-engine

2:yum安装docker-ce

添加docker镜像源两种方式

yum -y isntall yum-util
yum-config-manager     --add-repo     https://download.docker.com/linux/centos/docker-ce.repo

docker官方镜像源

[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://download.docker.com/linux/centos/7/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-stable-debuginfo]
name=Docker CE Stable - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/stable
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-stable-source]
name=Docker CE Stable - Sources
baseurl=https://download.docker.com/linux/centos/7/source/stable
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-edge]
name=Docker CE Edge - $basearch
baseurl=https://download.docker.com/linux/centos/7/$basearch/edge
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-edge-debuginfo]
name=Docker CE Edge - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/edge
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-edge-source]
name=Docker CE Edge - Sources
baseurl=https://download.docker.com/linux/centos/7/source/edge
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-test]
name=Docker CE Test - $basearch
baseurl=https://download.docker.com/linux/centos/7/$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-test-debuginfo]
name=Docker CE Test - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-test-source]
name=Docker CE Test - Sources
baseurl=https://download.docker.com/linux/centos/7/source/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-nightly]
name=Docker CE Nightly - $basearch
baseurl=https://download.docker.com/linux/centos/7/$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-nightly-debuginfo]
name=Docker CE Nightly - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-nightly-source]
name=Docker CE Nightly - Sources
baseurl=https://download.docker.com/linux/centos/7/source/nightly
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

3:安装docker引擎

yum install docker-ce docker-ce-cli containerd.io

4:查看版本

[ yum.repos.d]# docker version
Client: Docker Engine - Community  # 这个是客户端
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:46:54 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community # 这个是服务端,且这个是社区版服务端
 Engine:
  Version:          19.03.12
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       48a66213fe
  Built:            Mon Jun 22 15:45:28 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
[ yum.repos.d]#

5:开机启动,查看状态

systemctl start docker # 启动服务
systemctl status docker # 查看状态
systemctl enable docker # 开机启动

6:修改配置文件

查看配置文件所在位置

查看yum安装docker服务的文件位置

# 首先查看安装的docker的软件
[ ~]# rpm -qa | grep docker*
docker-ce-cli-19.03.12-3.el7.x86_64
docker-ce-19.03.12-3.el7.x86_64

#查看docker-ce服务端安装的包位置
[ ~]# rpm -ql docker-ce-19.03.12-3.el7.x86_64
/usr/bin/docker-init # 初始化
/usr/bin/docker-proxy # 与网络有关的程序  这三个是管理docker服务端的命令
/usr/bin/dockerd      # 后台程序
/usr/lib/systemd/system/docker.service # 服务启动的配置文件
/usr/lib/systemd/system/docker.socket # 只是启动了一个端口或者是一个sockert
[ ~]# rpm -ql docker-ce-19.03.12-3.el7.x86_64

# 查看docker-cli服务端安装软件包的位置

[ ~]# rpm -ql docker-ce-cli-19.03.12-3.el7.x86_64
目录太多我就不复制粘贴了

配置文件

/etc/docker/key.json # 这个是docker配置文件
配置项稍后再说

相关推荐