1、下載下傳docker的安裝檔案
https://download.docker.com/linux/static/stable/x86_64/
由于公司OpenStack用的docker版本是18.09.0

2、上傳docker-18.09.0-ce.tgz 到系統,用ftp工具上傳即可
3、解壓
tar -zxvf docker-18.06.3-ce.tgz
4、将解壓出來的docker檔案複制到 /usr/bin/ 目錄下
cp docker/* /usr/bin/
5、進入/etc/systemd/system/目錄,并建立docker.service檔案
cd /etc/systemd/system/
vi docker.service
6、将以下内容複制進去(192.168.100.108改為你的伺服器IP)
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd --selinux-enabled=false --insecure-registry=192.168.100.108
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
7、給docker.service檔案添加執行權限
chmod 777 /etc/systemd/system/docker.service
8、重新加載配置檔案(每次有修改docker.service檔案時都要重新加載下)
systemctl daemon-reload
9、啟動
systemctl start docker
10、設定開機啟動
systemctl enable docker.service
11、檢視docker狀态
systemctl status docker
出現下面這個界面就代表docker安裝成功:
12、配置鏡像加速器,預設是到國外拉取鏡像速度慢,可以配置國内的鏡像如:阿裡、網易等等。
下面配置一下網易的鏡像加速器。打開docker的配置檔案: /etc/docker/daemon.json檔案:
vi /etc/docker/daemon.json
配置如下:
{"registry-mirrors": ["http://hub-mirror.c.163.com"]}
13、儲存配置并重新開機docker 一定要重新開機不然加速是不會生效的!!!
service docker restart
14、測試docker導入安裝鏡像
h1_01_import_images.sh
導入鏡像
檢視鏡像
運作容器并進入
OK,到此沒有問題,無網環境安裝docker成功!!
Only action can relieve the uneasiness.