docker离线安装
1. 概览
- 系统:centos、Ubuntu
- 安装方法:二进制安装 & deb包安装
- 版本:17.09.1-ce、18.06.3-ce
2. 安装
2.1 centos安装docker(使用二进制包安装)
- 获取docker二进制安装包
wget https://download.docker.com/linux/static/stable/x86_64/docker-18.06.3-ce.tgz
- 解压复制到系统目录
tar xf docker-18.06.3.tgz
cp docker/* /usr/bin/
- 各版本链接
https://download.docker.com/linux/static/stable/x86_64/
- 编写/etc/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/bin/dockerd --selinux-enabled=false --insecure-registry=192.168.158.154
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
ps: --insecure-registry=192.168.158.154使用时需要修改为自己的IP,或者可以不使用这个参数
- 启动
chmod +x /etc/systemd/system/docker.service
systemctl daemon-reload
systemctl start docker
systemctl enable docker.service
- 验证
systemctl status docker
docker -v
2.2 Ubuntu安装(deb包安装)
- 获取docker及依赖deb安装包
wget https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/docker-ce_17.09.1~ce-0~ubuntu_amd64.deb
wget http://launchpadlibrarian.net/236916213/libltdl7_2.4.6-0.1_amd64.deb
- 安装依赖及docker
sudo dpkg -i libltdl7_2.4.6-0.1_amd64.deb
sudo dpkg -i docker-ce_17.09.1_ce-0_ubuntu_amd64.deb
- 各docker版本链接
https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/
- 验证
systemctl status docker
docker -v
文章目录
关闭