首頁 > 運維 > Docker > linux下如何在內網安裝docker

linux下如何在內網安裝docker

王林
發布: 2020-04-15 15:34:13
原創
3929 人瀏覽過

linux下如何在內網安裝docker

一、基礎環境

1、作業系統:CentOS 7.3

2、Docker版本:18.06.1

#二、Docker安裝

1、解壓縮

tar -xvf docker-18.06.1-ce.tgz
登入後複製

2、將解壓縮出來的docker檔案內容移到/usr/bin/ 目錄下

cp docker/* /usr/bin/
登入後複製

3、將docker註冊為service

vim /etc/systemd/system/docker.service
登入後複製

將下列配置加到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/bin/dockerd
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
登入後複製

4、啟動

chmod +x /etc/systemd/system/docker.service    #添加文件权限并启动docker
systemctl daemon-reload    #重载unit配置文件
systemctl start docker    #启动Docker
systemctl enable docker.service  #设置开机自启
登入後複製

5、驗證

systemctl status docker   #查看Docker状态
docker -v   #查看Docker版本
登入後複製

推薦教學:docker教學

以上是linux下如何在內網安裝docker的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板