安装docker

1、Docker要求CentOS系统的内核版本高于 3.10 ,通过 uname -r 命令查看你当前的内核版本是否支持

 

下载docker包:https://download.docker.com/linux/static/stable/x86_64/

 

 

cp docker/* /usr/bin/

修改ip为本机ip

cd /etc/systemd/system/

vi 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=121.4.43.213

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

 

授予读写执行权限

chmod 777 /etc/systemd/system/docker.service

重新加载修改后的文件

systemctl daemon-reload

启动docker

systemctl start docker

指定国内下载源

cd /etc/docker

 touch daemon.json

{"registry-mirrors": ["http://hub-mirror.c.163.com"]}

mv daemon.json daemon.conf

重启docker

systemctl start docker.service

查看docker状态systemctl status docker

 

 

 

 

 

 

 

 

参考文档:

https://blog.csdn.net/m0_52789121/article/details/126326819?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-126326819-blog-125503680.pc_relevant_multi_platform_whitelistv4&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-126326819-blog-125503680.pc_relevant_multi_platform_whitelistv4&utm_relevant_index=1

https://blog.csdn.net/m0_67391120/article/details/126327446

posted @ 2020-01-20 21:07  给明天的自己  阅读(238)  评论(0编辑  收藏  举报