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
相关推荐
python百炼成钢2 分钟前
50.linux_USB驱动
linux·运维·服务器·驱动开发
jay21 分钟前
ens2f0 IP 远程连线,balance-alb 模式配置双网卡(ens2f0 + ens6f0)Bond,避免断网
linux·运维·服务器·网络·tcp/ip
todoitbo1 小时前
openEuler 云原生实战:Docker Compose 部署 Nextcloud 企业级私有云
docker·云原生·容器·openeuler
Evan芙1 小时前
用Shell脚本破解经典鸡兔同笼问题
linux·运维·网络
꧁坚持很酷꧂2 小时前
Ubuntu系统下Qt程序连接串口设备没有问题,但运行时出现Permission denied的解决方法
linux·qt·ubuntu
jerryinwuhan2 小时前
机器人控制程序
linux·运维·网络
honeysuckle_luo2 小时前
香橙派ai pro安装支持昇腾NPU的ollama
linux·运维·服务器
池央2 小时前
从“算子不支持”到“NPU高效执行”:CANN 8.0 TBE 自定义算子落地实践
linux·人工智能
小锋学长生活大爆炸2 小时前
【教程】CentOS在不知道root密码的情况下进入shell和重置密码
linux·运维·centos
weixin_46683 小时前
Docker常用命令与操作
运维·docker·容器