离线安装docker(任何版本)

1.下载docker二进制包

arm:官方下载地址:https://download.docker.com/linux/static/stable/aarch64/

x86:官方下载地址:  https://download.docker.com/linux/static/stable/x86_64/

2.使用wget下载或者直接打开网站下载对应版本到服务器,如:19.03.8

wget https://download.docker.com/linux/static/stable/x86_64/docker-19.03.8.tgz

或者:

3.解压下载好的docker包

tar zxf docker-19.03.8.tgz

4.将docker目录下的二进制文件移动到/usr/bin/

mv docker/* /usr/bin/

5.测试docker

docker

6.编写docker守护进程daemon.json(insecure-registries:[私有镜像仓库地址])

[root@localhost sophon]# cat /etc/docker/daemon.json 
{
"exec-opts": ["native.cgroupdriver=systemd"],
"graph": "/data/docker_storage",
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2",
"storage-opts": [
"overlay2.override_kernel_check=true"
],
"insecure-registries" : ["192.168.4.17:8090","111.136.254.111:8090"],
"registry-mirrors": ["https://g427vmjy.mirror.aliyuncs.com"],
"live-restore": true
}

7.编写docker.server,配置开机启动

[root@localhost sophon]# cat /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
EnvironmentFile=-/etc/sysconfig/docker
EnvironmentFile=-/etc/sysconfig/docker-storage
EnvironmentFile=-/etc/sysconfig/docker-network
Environment=GOTRACEBACK=crash

ExecStart=/usr/bin/dockerd -H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
# 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

[Install]
WantedBy=multi-user.target

8.启动docker服务

systemctl daemon-reload
systemctl restart docker
systemctl enable docker

 

9.参考文档

https://www.cnblogs.com/tian880820/p/16057047.html

 

注意:此部署方式,arm以及x86上都适用!!!

posted @ 2024-06-13 17:00  Leonardo-li  阅读(87)  评论(0编辑  收藏  举报