docker 安装
1、安装、
wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
sed -i 's#download.docker.com#mirrors.ustc.edu.cn/docker-ce#g' /etc/yum.repos.d/docker-ce.repo
yum install docker-ce -y
systemctl enable docker.service
systemctl restart docker.service
2、配置docker镜像加速
vi /etc/docker/daemon.json { "registry-mirrors": ["https://registry.docker-cn.com"] }
3、配置docker远程端口监听
vim /usr/lib/systemd/system/docker.service ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -H tcp://10.0.0.100:2375 ## 阿里云服务器 将10.0.0.100 改成 内网地址 或者 0.0.0.0 即可 systemctl daemon-reload systemctl enable docker.service systemctl restart docker.service
测试:
选择另一台安装好docker的阿里云服务器
[root@iZbp16cdvzk4rhl0vn1gedZ ~]# docker -H 172.16.77.9 info ## 172.16.77.9 为内网地址
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 18.09.3
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: 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 local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: e6b3f5632f50dbc4e9cb6288d911bf4f5e95b18e
runc version: 6635b4f0c6af3810594d2770f662f34ddc15b40d
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-693.2.2.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.702GiB
Name: iZbp1jcx2imdc3mj7mqdh0Z
ID: 4DW7:2BJO:CC6D:IASY:IFVK:IBIG:OKX7:HUNK:7WBS:AKT5:IDA3:VZAT
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
Registry Mirrors:
https://registry.docker-cn.com/
Live Restore Enabled: false
Product License: Community Engine
WARNING: API is accessible on http://0.0.0.0:2375 without encryption.
Access to the remote API is equivalent to root access on the host. Refer
to the 'Docker daemon attack surface' section in the documentation for
more information: https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
[root@iZbp16cdvzk4rhl0vn1gedZ ~]# docker -H 47.111.xx.xx info ##链接外网地址时,此时是无法获取到信息的,需要开通阿里云安全组的2375端口才能访问
。。。(无信息)