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
相关推荐
垂直昵称9 分钟前
多线程实现网页接口并发压力测试
linux·服务器·windows
jufeng13071 小时前
【系列:MiniKV 原理剖析 · 第 2 篇】
linux·c++·软件工程
王琦03181 小时前
Linux的管理程序
linux·运维·服务器
Crazy________2 小时前
Redis02:库切换、监控与安全配置
linux·redis·云原生·mybatis
瑞码空间2 小时前
Web应用的多端部署之道:浏览器 · Electron · Docker
前端·docker·electron·浏览器·web
Eloudy2 小时前
给 Linux 加新硬盘的挂载命令
linux·运维·服务器
三言老师2 小时前
ss高效查看网络连接端口实操
linux·运维·服务器·网络
三言老师2 小时前
traceroute路由追踪实操
linux·运维·服务器·网络
badhope3 小时前
Docker镜像从2GB压到80MB——我被运维追着打了三天才学会的容器瘦身术
docker
我是小灰灰吖3 小时前
Ubuntu 22.04 切换为 X11 会话以解决 QT 桌面程序兼容性问题
linux·qt·ubuntu