linux 一键安装docker docker-compose

shell 复制代码
# 环境 deploy.sh  docker-19.03.9.tgz  docker-compose-linux-x86_64
tar -zxvf docker-19.03.9.tgz
mv docker-19.03.9 docker
cp docker/* /usr/bin/
touch /etc/systemd/system/docker.service
cat << EOG > /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
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
EOG
#给docker.service文件添加执行权限
chmod +x /etc/systemd/system/docker.service
#重新加载配置文件(每次有修改docker.service文件时都要重新加载下)
systemctl daemon-reload   
#启动docker
systemctl start docker
设置开机启动
#systemctl enable docker.service
#查看docker服务状态
mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose -v
systemctl status docker
相关推荐
Android系统攻城狮4 小时前
Linux Gstreamer深度解析之gst_audio_ring_buffer_parse_caps调用流程与实战(八十)
linux·运维·服务器·gstreamer音视频·音视频进阶
erzong2315 小时前
Linux网络:UDP编程踩坑日记
linux·网络·udp
盐焗鹌鹑蛋5 小时前
【Linux】线程库与封装
linux
lwx9148525 小时前
Deepin操作系统
linux·服务器·网络
先知后行。5 小时前
进程间通信(IPC)
linux·运维·服务器
weixin_571667416 小时前
Windows 通过 SSH 反向隧道向 Ubuntu 转发代理
linux·运维·windows·代理
乔旭伟6 小时前
CentOS 停更迁移实战:vault 源配置、目标选型与迁移工程清单
linux·运维·centos
鬼手点金6 小时前
ReAct 循环
linux·服务器·前端·javascript·react.js·前端框架
皓月盈江6 小时前
Linux Debian下STM32CubeProgrammer串口连接失败解决方案
linux·stm32·debian·串口下载·stm32f103c8t6·usb转ttl·stm32cubepro
EterNity_TiMe_6 小时前
Docker服务越装越多记不住端口?我用Fenrus把NAS里的常用入口整理成一个导航页
运维·人工智能·docker·ai·容器·cpolar