离线安装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版本的话,就要充分测试一些。