Docker版本:18.06.1安装

1、操作系统:CentOS 7.5以上

2、Docker版本:18.06.1

1、解压

powershell 复制代码
tar -xvf docker-18.06.1-ce.tgz

2、将解压出来的docker文件内容移动到 /usr/bin/ 目录下

powershell 复制代码
cp docker/* /usr/bin/

3、将docker注册为service

powershell 复制代码
vim /etc/systemd/system/docker.service

将下列配置加到docker.service中并保存。

powershell 复制代码
[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、启动

powershell 复制代码
chmod  +x /etc/systemd/system/docker.service    #添加文件权限并启动docker
systemctl daemon-reload    #重载unit配置文件
systemctl start docker    #启动Docker
systemctl enable docker.service  #设置开机自启

5、验证

powershell 复制代码
systemctl status docker   #查看Docker状态
docker -v   #查看Docker版本
相关推荐
Meaauf6 小时前
Registry私有容器镜像仓库搭建
docker·容器·registry
always20226 小时前
AI Infra · 02 - AI 感知的任务调度:Gang Scheduling、拓扑感知与潮汐弹性
人工智能·docker·kubernetes
Monkey的自我迭代10 小时前
K8S详细学习1——为什么选择k8s
学习·docker·kubernetes
zjeweler10 小时前
Nginx 502 Bad Gateway怎么解决?Docker反代与PHP-FPM报错全链路排查
nginx·docker·php-fpm·502 bad gateway·实用建站
木雷坞1 天前
n8n Docker 读不到 CSV,先分清宿主机目录和容器路径
java·docker·容器
有风听风有雨看雨1 天前
MinIO 单节点Docker(密码放配置文件)
运维·docker·容器
长不大的杨瑞杰1 天前
Kubernetes CrashLoopBackOff 排障全流程:OOM、探针、应用退出与依赖故障定责
docker·云原生·容器·kubernetes·devops·oomkilled
车软学堂1 天前
Docker在隔离什么:namespace、cgroup、chroot三道墙
linux·python·docker·容器·车载系统·汽车·测试用例
方便面不加香菜1 天前
Docker 网络原理 -- 常见的网络虚拟化
网络·docker·容器
芯飞云1 天前
8核16G云服务器到手后,用Docker Compose跑一个完整服务栈
运维·服务器·docker