本文采用yum install 的方式來安裝docker
第一步:安裝yum安裝配置工具(如果直接可以下載阿里雲對應的docker-ce.repo此步驟一、二、三可以省略)
$ sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
第二步:生成yum安裝docker的配置文件
$ sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
第三步:替換docker-ce.repo 裏邊的內容,主要目的是解決牆的問題
vi /etc/yum.repos.d/docker-ce.repo
將“https://download-stage.docker.com/”全部替換爲“https://mirrors.aliyun.com/docker-ce/”
第四步:
sudo yum install docker-ce
第五步:驗證
[root@node2 ~]# docker info
Containers: 18
Running: 12
Paused: 0
Stopped: 6
Images: 9
Server Version: 18.06.0-ce
Storage Driver: overlay2
Backing Filesystem: xfs
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 logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: d64c661f1d51c48782c9cec8fda7604785f93587
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-862.6.3.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.779GiB
Name: node2
ID: SRQ4:AW4N:UD4J:35DZ:UWGH:NIB3:DXLG:EYAJ:IS55:R5WA:UBBD:EMLJ
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://v341mqs3.mirror.aliyuncs.com/
Live Restore Enabled: false
注:docker相關命令可以自行網上查看