选择操作系统版本

[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 

配置网卡

固定ip地址,开机激活忘啦,并且能够联网

TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=76fc1a45-394d-45bb-8796-6b449d0a77bb
DEVICE=ens33
ONBOOT=yes
GATEWAY=192.168.100.2
DWADDR=00:0c:29:b9:b3:a6
IPADDR=192.168.100.128
DNS1=114.114.114.114
DNS2=8.8.8.8

配置源

由于国内的源比较卡,所以我们推荐使用daocloud的方式

curl -sSL https://get.daocloud.io/docker | sh

配置镜像

国内通常默认docker hub的网速不稳定,可以配置daocloud提供的docker hub

[root@localhost ~]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://681a96df.m.daocloud.io
docker version >= 1.12
{"registry-mirrors": ["http://681a96df.m.daocloud.io"]}
Success.
You need to restart docker to take effect: sudo systemctl restart docker 

查看自己配置的docker hub

[root@localhost ~]# cat /etc/docker/daemon.json
{"registry-mirrors": ["http://681a96df.m.daocloud.io"]}

重启docker

systemctl restart docker

查看docker基本信息

[root@localhost ~]#  docker info 
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 17.09.0-ce
Storage Driver: overlay
 Backing Filesystem: xfs
 Supports d_type: true
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: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
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: 1
Total Memory: 3.686GiB
Name: bogon
ID: 262X:2R66:O4BX:26JN:JL6S:X4SZ:TM6H:VDAN:JRU3:XZJ6:NPBK:KPKS
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
Registry Mirrors:
 http://681a96df.m.daocloud.io/
Live Restore Enabled: false

查看docker服务

image
image

修改host和port

image
image

重新加载service文件,并且重启docker服务

[root@bogon ~]# systemctl daemon-reload
[root@bogon ~]# systemctl restart docker

连接远程执行docker命令
[root@bogon ~]#  docker -H 192.168.100.129:2375 images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE