sunfull 发表于 2018-5-26 09:58:11

Docker CE 全自动安装

  操作系统

# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
# uname -r
3.10.0-514.el7.x86_64  安装代码如下所示:

#!/bin/bash
#2018-2-26 15:34:05
#auto install docker-ce on CentOS 7
#by author dengaosky
######################
#Uninstall old versions
yum remove -y docker docker-common docker-selinux docker-engine
#Install using the repository
yum install -y yum-utils device-mapper-persistent-data lvm2
##yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#Disable the edge and test repositories
yum-config-manager --disable docker-ce-edge
yum-config-manager --disable docker-ce-test
#INSTALL DOCKER CE
yum install docker-ce -y
#Config docker
cat >/etc/docker/daemon.json <<EOF
{&quot;registry-mirrors&quot;: [&quot;http://df98fb04.m.daocloud.io&quot;]}
EOF
#Disable Firewalld,Install and Enable iptables
systemctl disable firewalld;systemctl stop firewalld
yum install iptables-services -y
systemctl enable iptables;systemctl restart iptables
#Disable Selinux
setenforce 0
sed -i '/SELINUX/s/enforcing/disabled/g' /etc/selinux/config
#Start Docker
systemctl start docker
systemctl enable docker  Docker版本信息:
# docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 17.12.0-ce
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 89623f28b87a6004d4b785663257362d1658a729
runc version: b2567b37d7b75eb4cf325b77297b140ea686ce8f
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-514.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.938GiB
Name: localhost.localdomain
ID: WMF3:D2KK:5ODB:LAS3:MJKI:QMLJ:H2H7:2BWN:6EMW:J7CS:2YIZ:Z4HW
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
#
页: [1]
查看完整版本: Docker CE 全自动安装