离线安装docker和docker-compose

操作系统: UOS Desktop 20 Professional

安装包:docker-24.0.9.tgz,docker-compose-linux-x86_64

离线安装docker

1.将安装包docker-24.0.9.tgz上传至packages,并进行解压 tar -zxvf docker-24.0.9.tgz;

2.将解压后的文件拷贝至/usr/bin: cp ./docker/* /usr/bin;

3.配置守护进程,编写vi /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 -H unix:///var/run/docker.sock --selinux-enabled=false --default-ulimit nofile=65536:65536
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

4.添加可执行权限,重载守护进程,启动服务。

chmod +x /etc/systemd/system/docker.service

systemctl daemon-reload

systemctl start docker

通过docker version命令查看docker版本。

离线安装docker-compose

1.将docker-compose-linux-x86_64拷贝至/usr/bin目录;

2.修改名称, mv docker-compose-linux-x86_64 docker-compose;

3.添加可执行权限:chmod +x docker-compose;

执行docker-compose version即可查看版本。

问题及建议

使用docker部署mysql5.6时正常,但部署8.0.39版本时容器启动失败,原因未知。

建议使用系统厂家充分测试过的docker版本,虽然版本低,但是稳定点。

使用离线部署的新的docker版本的话,就要充分测试一些。

相关推荐
礼拜天没时间.9 分钟前
深入Docker架构——C/S模式解析
linux·docker·容器·架构·centos
猫头虎14 分钟前
如何使用Docker部署OpenClaw汉化中文版?
运维·人工智能·docker·容器·langchain·开源·aigc
会周易的程序员25 分钟前
openplc runtimev4 Docker 部署
运维·c++·物联网·docker·容器·软件工程·iot
小Pawn爷1 小时前
1.Docker基础
运维·docker·容器
chinesegf1 小时前
清理docker残留镜像images
运维·docker·容器
小Pawn爷1 小时前
2.Docker的存储
运维·docker·容器
礼拜天没时间.2 小时前
自定义镜像制作——从Dockerfile到镜像
linux·docker·容器·centos·bash
luffy54592 小时前
windows下通过docker-desktop创建redis实例
windows·redis·docker·容器
weixin_404679313 小时前
docker部署ollama
运维·docker·容器
Hi202402173 小时前
在Docker容器中安全运行OpenClaw:无需虚拟机,体验AI助手
人工智能·安全·docker·openclaw