/etc/crontab 系統配置檔案說明
阿新 • • 發佈:2021-08-23
centos安裝docker
- CentOS版本:7.9
- docker版本:18.06.3
前言
說是離線安裝,還是要先線上下載安裝包。docker官網提供離線安裝的二進位制包。
步驟
- 官網下載安裝包。連結:https://download.docker.com/linux/static/stable/x86_64/docker-18.06.3-ce.tgz
- 解壓安裝包,將安裝包內的二進位制程式挪到
/usr/local/bin
目錄。 - 建立docker資料存放目錄:
mkdir -p /home/data/docker
- 建立docker服務檔案:
vim /usr/lib/systemd/system/docker.service
[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/local/bin/dockerd --data-root /home/data/docker 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
- 配置生效:
systemctl daemon-reload
systemctl start docker
systemctl enable docker