04.Rocky8二进制安装docker
适用于公司访问不了外网
step 1 从阿里云下载包并解压
1.windows和linux下载都行
1)windows:
阿里云
我选择的是docker-20.10.10.tgz
然后通过ftp传到rocky8上去
crt的ftp快捷键alt+p
xshell直接用xftp就行
2)linux
我下载到/root路径下了
cd /root
wget https://mirrors.aliyun.com/docker-ce/linux/static/stable/x86_64/docker-20.10.10.tgz
step 2 解压并复制
tar xvf docker-20.10.10.tgz
cd /root/docker
cp * /usr/bin/
解压结果
[root@rocky8 ~]#tar xvf docker-20.10.10.tgz
docker/
docker/docker-init
docker/docker
docker/dockerd
docker/runc
docker/ctr
docker/docker-proxy
docker/containerd
docker/containerd-shim
step 3 配置service文件
vi /lib/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
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
step 4 加载和启动以及查看状态
[root@rocky8 ~]# systemctl daemon-reload
[root@rocky8 ~]# systemctl enable --now docker
[root@rocky8 ~]# systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2022-11-18 02:31:24 EST; 3s ago
Docs: https://docs.docker.com
Main PID: 2709 (dockerd)
Tasks: 17 (limit: 11174)
Memory: 31.9M
CGroup: /system.slice/docker.service
├─2709 /usr/bin/dockerd -H unix://var/run/docker.sock
└─2716 containerd --config /var/run/docker/containerd/containerd.toml --log-level info
查看docker版本
docker version