centos7 在线安装docker

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/kongshuai19900505/article/details/83587171

1.安装阶段

直接使用yum命令安装

1)先清理系统,保证系统是干净的:

[root@localhost ~]# yum remove docker  docker-common docker-selinux docker-engine

2)安装依赖、更新源、安装docker

[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
更新完毕:
  device-mapper-libs.x86_64 7:1.02.146-4.el7                                                                                       

作为依赖被升级:
  device-mapper.x86_64 7:1.02.146-4.el7                              device-mapper-event.x86_64 7:1.02.146-4.el7                  
  device-mapper-event-libs.x86_64 7:1.02.146-4.el7                   lvm2.x86_64 7:2.02.177-4.el7                                 
  lvm2-libs.x86_64 7:2.02.177-4.el7                                 

完毕!
[root@localhost ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
[root@localhost ~]# yum list docker-ce --showduplicates | sort -r
[root@localhost ~]# yum install docker*
已安装:
  docker.x86_64 2:1.13.1-75.git8633870.el7.centos                                                                                  

作为依赖被安装:
  docker-client.x86_64 2:1.13.1-75.git8633870.el7.centos           docker-common.x86_64 2:1.13.1-75.git8633870.el7.centos          

完毕!

3)查看安装情况,出现版本信息,说明安装成功

[root@localhost ~]# docker --version
Docker version 1.13.1, build 8633870/1.13.1

2.docker配置

1)关闭防火墙

[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl disable firewalld.service

2)关闭SELINUX

[root@localhost ~]# vi /etc/sysconfig/selinux 
#设置
SELINUX=disabled
[root@localhost ~]# setenforce 0

3)修改docker配置文件

[root@localhost ~]#vim /etc/sysconfig/docker

# /etc/sysconfig/docker

# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled=false --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
    DOCKER_CERT_PATH=/etc/docker
fi

4.启动docker,查看信息

[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# service docker restart
[root@localhost ~]# docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 1.13.1
Storage Driver: overlay2
 Backing Filesystem: xfs
 Supports d_type: true
 Native Overlay Diff: false
Logging Driver: journald
Cgroup Driver: systemd
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: docker-runc runc
Default Runtime: docker-runc
Init Binary: /usr/libexec/docker/docker-init-current
containerd version:  (expected: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1)
runc version: 5eda6f6fd0c2884c2c8e78a6e7119e8d0ecedb77 (expected: 9df8b306d01f59d3a8029be411de015b7304dd8f)
init version: fec3683b971d9c3ef73f284f176672c44b448662 (expected: 949e6facb77383876aeff8a6944dde66b3089574)
Security Options:
 seccomp
  WARNING: You're not using the default seccomp profile
  Profile: /etc/docker/seccomp.json
Kernel Version: 3.10.0-514.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
Number of Docker Hooks: 3
CPUs: 1
Total Memory: 976.5 MiB
Name: localhost.localdomain
ID: J6I6:AK44:CXLO:EFQU:ZWF4:6BEA:3BOP:OP2P:YUMR:QFKK:PJG5:W7OT
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Registries: docker.io (secure)

至此,docker安装启动完毕

猜你喜欢

转载自blog.csdn.net/kongshuai19900505/article/details/83587171
今日推荐