docker离线和在线部署手册

Docker离线安装手册
1.下载安装包
1.1在网上下载,或者自己提前下载好上传
Wget https://download.docker.com/linux/static/stable/x86_64/docker-19.03.5.tgz
2.解压
tar -xvf docker-19.03.5.tgz
3.将解压出来的docker目录下的文件移动到 /usr/bin/ 目录下
cp docker/* /usr/bin/
4将docker注册为系统service
vi /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/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=onfailure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target

5.启动docker

添加文件权限并启动docker

chmod u+x /usr/lib/systemd/system/docker.service

重载unit配置文件

systemctl daemon-reload

启动Docker

systemctl start docker
6.检查docker是否启动
systemctl status docker

Docker再线安装手册
1.安装yum-utils包
yum install -y yum-utils
2设置镜像
cd /etc/yum.repos.d/
mkdir bak
mv *.repo bak
curl -o /etc/yum.repos.d/EulerOS-base.repo http://mirrors.myhuaweicloud.com/repo/EulerOS_2_2_base.repo
3.安装docker引擎
yum install docker-ce docker-ce-cli containerd.io
4.启动docker
systemctl start docker
5.检查docker是否启动
systemctl status docker

如果安装到第三步遇到问题可以参考下边的解决方案

你可能感兴趣的:(docker,容器,运维)