当前位置:   article > 正文

Ubuntu系统以二进制文件安装docker(离线方式安装)_docker ubantu 二进制

docker ubantu 二进制

项目背景:由于项目需要保密,不能联网,因此需要离线安装docker容器并导入镜像。

一、下载二进制安装包

先在下面网址中下载docker容器的二进制安装包,Ubuntu系统选择最后一个x86_64

 https://download.docker.com/linux/static/stable/

二、解压下载的docker容器的二进制安装包

ljjx@ljjx-virtual-machine:~/test$ sudo tar -xvf docker-24.0.5.tgz

三、将可执行文件复制到系统运行命令下

将二进制文件移动到可执行文件路径上的目录,一般是 /usr/bin/

ljjx@ljjx-virtual-machine:~/test$ sudo cp docker/* /usr/bin/

此处需要注意:不要直接在 /usr/bin/目录下解压第一步下载的二进制的压缩包,否则在打开docker容器时会报如下错误:

  1. ljjx@ljjx-virtual-machine:/usr/bin$ sudo systemctl start docker && systemctl enable docker
  2. Job for docker.service failed because the control process exited with error code.
  3. See "systemctl status docker.service" and "journalctl -xeu docker.service" for details.

四、docker容器项目配置

在/etc/systemd/system目录下创建docker.service文件,并将相关参数写入该文件中,并配置如下内容保存。

创建文件并打开采用下面的命令:

ljjx@ljjx-virtual-machine:~/test$ sudo vim /usr/lib/systemd/system/docker.service

文件配置内容如下:

  1. [Unit]
  2. Description=Docker Application Container Engine
  3. Documentation=https://docs.docker.com
  4. After=network-online.target firewalld.service
  5. Wants=network-online.target
  6. [Service]
  7. Type=notify
  8. # the default is not to use systemd for cgroups because the delegate issues still
  9. # exists and systemd currently does not support the cgroup feature set required
  10. # for containers run by docker
  11. ExecStart=/usr/bin/dockerd
  12. ExecReload=/bin/kill -s HUP $MAINPID
  13. # Having non-zero Limit*s causes performance problems due to accounting overhead
  14. # in the kernel. We recommend using cgroups to do container-local accounting.
  15. LimitNOFILE=infinity
  16. LimitNPROC=infinity
  17. LimitCORE=infinity
  18. # Uncomment TasksMax if your systemd version supports it.
  19. # Only systemd 226 and above support this version.
  20. #TasksMax=infinity
  21. TimeoutStartSec=0
  22. # set delegate yes so that systemd does not reset the cgroups of docker containers
  23. Delegate=yes
  24. # kill only the docker process, not all processes in the cgroup
  25. KillMode=process
  26. # restart the docker process if it exits prematurely
  27. Restart=on-failure
  28. StartLimitBurst=3
  29. StartLimitInterval=60s
  30. [Install]
  31. WantedBy=multi-user.target

五、docker容器的启动

  1. 启动命令:
  2. ljjx@ljjx-virtual-machine:~/test$ sudo systemctl start docker
  1. 查看docker运行状态:
  2. ljjx@ljjx-virtual-machine:~/test$ sudo systemctl status docker

结果如下图所示:

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/730587
推荐阅读
相关标签
  

闽ICP备14008679号