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
相关推荐
ALex_zry几秒前
Consul全方位入门指南:第二阶段—— 实操。Consul核心功能与项目集成
运维·docker·微服务·云原生·架构
zzzsde33 分钟前
【Linux】基础开发工具(2):vim补充说明&&gcc/g++编译器
linux·运维·服务器
2501_941144031 小时前
Julia高性能科学计算与数据分析实践分享:多线程优化与大规模矩阵运算经验
eureka
q***65691 小时前
使用Canal将MySQL数据同步到ES(Linux)
linux·mysql·elasticsearch
热爱学习的小怪兽1 小时前
Docker容器的一些总结
运维·docker·容器
2301_807583231 小时前
了解python,并编写第一个程序,常见的bug
linux·python
杨德杰2 小时前
Ubuntu设置VNC远程桌面
linux·运维·ubuntu
❀͜͡傀儡师2 小时前
Docker一键部署Nexus Terminal,高颜值SSH新体验
docker·容器·ssh
写代码的学渣3 小时前
Ubuntu/麒麟默认锁定root账户
linux·运维·ubuntu
while(努力):进步3 小时前
智能物流背景下基于 Python 构建高效仓储与配送调度系统的架构设计与工程实践经验分享
eureka