Linux Redhat 7.9 下 Docker 离线安装部署
Docker安装前要
Docker官网:
服务器版:https://docs.docker.com/engine/install/#server
Docker 离线二进制tgz压缩包下载地址:https://download.docker.com/linux/static/stable/x86_64/
例如下载:docker-23.0.6.tgz
Docker 离线rpm包下载地址:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
Docker离线安装步骤:
1、确定OS系统环境,CentOS 7/Redhat 7及以上版本
# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.9 (Maipo) # uname -a Linux vm-ldp-sentry-test 3.10.0-1160.el7.x86_64 #1 SMP Tue Aug 18 14:50:17 EDT 2020 x86_64 x86_64 x86_64 GNU/Linux
2、卸载旧版本
yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
3、下载离线安装包,上传至服务端并解压,并将解压后得到的二进制文件全复制到/usr/bin目录下.
# ls -lh total 12534 drwxrwxr-x 2 1000 1000 146 May 6 2023 docker -rw-r--r-- 1 root root 66999866 May 14 17:09 docker-23.0.6.tgz # cp docker/* /usr/bin/
4、将docker注册成系统服务,修改 "vi /etc/systemd/system/docker.service" 内容(没有的话vi命令会自动创建该文件);
注意:配置需要注意的是 : ExecStart=/usr/bin/dockerd,代表dockerd所在位置.
# cat /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 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
5、增加文件可执行权限
# chmod +x /etc/systemd/system/docker.service
# systemctl daemon-reload
6、设置开机自启动
# systemctl enable docker.service
# systemctl status docker.service
##systemctl disable docker.service
7、启动docker服务:
# systemctl start docker
#systemctl stop docker
# systemctl restart docker
参考文档:https://www.cnblogs.com/fukeyiyang/p/17896070.html

浙公网安备 33010602011771号