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
相关推荐
计算机安禾几秒前
【Linux从入门到精通】第13篇:磁盘管理与文件系统——数据存在哪了?
linux·运维·服务器
ai产品老杨几秒前
深度解析:基于 Docker 与异构计算的 AI 视频管理平台架构实现(支持 GB28181/RTSP 与源码交付)
人工智能·docker·音视频
温柔一只鬼.5 分钟前
Ubuntu 安装 Python 3.10 完整指南
linux·运维·ubuntu
keyipatience11 分钟前
10.Makefile构建奥秘:从基础到高效编译
linux·运维·服务器
说再见再也见不到19 分钟前
华为交换机端口隔离(port-isolate)
linux·服务器·网络·华为·交换机·端口隔离·port-isolate
daemon.qiang26 分钟前
Ubuntu 20.04+安装JFrog CLI超详细指南
linux·运维·ubuntu
湖城彭于晏27 分钟前
VMware Ubuntu 固定IP + 上网 + 远程访问 完整教程
linux·ubuntu·vmware
小夏子_riotous27 分钟前
Docker学习路径——6、简单微服务
linux·运维·服务器·docker·微服务·容器·云计算
剪刀石头布Cheers27 分钟前
Ubuntu Hermes安装关键步骤
linux·运维·ubuntu·ai·agent·hermes
AI服务老曹32 分钟前
解密万物互联:基于 Docker 的 GB28181/RTSP 统一协议网关与 AI 视频平台架构实践
人工智能·docker·音视频