当前位置:   article > 正文

linux安装docker

linux安装docker

国内不能连接到docker资源

Linux系统CentOS7.9

下载 docker

  1. # VERSION_STRING=26.1.0
  2. # wget https://download.docker.com/linux/static/stable/x86_64/docker-${VERSION_STRING}.tgz
  3. # tar xf docker-${VERSION_STRING}.tgz

服务器链接不上资源  本地下载安装包  我使用的是  26.1.4  

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

也可以从这里下载

https://download.csdn.net/download/sunsijia21983/89484849?spm=1001.2014.3001.5501

下载后,上传到服务器

查看 docker 可执行文件

# ls -l docker/

total 194020

-rwxr-xr-x. 1 1000 1000 39182336 Apr 23 01:09 containerd

-rwxr-xr-x. 1 1000 1000 12488704 Apr 23 01:09 containerd-shim-runc-v2

-rwxr-xr-x. 1 1000 1000 19353600 Apr 23 01:09 ctr

-rwxr-xr-x. 1 1000 1000 38400232 Apr 23 01:09 docker

-rwxr-xr-x. 1 1000 1000 71280520 Apr 23 01:09 dockerd

-rwxr-xr-x. 1 1000 1000   708448 Apr 23 01:09 docker-init

-rwxr-xr-x. 1 1000 1000  1979949 Apr 23 01:09 docker-proxy

-rwxr-xr-x. 1 1000 1000 15272168 Apr 23 01:09 runc

查看 docker 可执行文件

# ls -l docker/

total 194020

-rwxr-xr-x. 1 1000 1000 39182336 Apr 23 01:09 containerd

-rwxr-xr-x. 1 1000 1000 12488704 Apr 23 01:09 containerd-shim-runc-v2

-rwxr-xr-x. 1 1000 1000 19353600 Apr 23 01:09 ctr

-rwxr-xr-x. 1 1000 1000 38400232 Apr 23 01:09 docker

-rwxr-xr-x. 1 1000 1000 71280520 Apr 23 01:09 dockerd

-rwxr-xr-x. 1 1000 1000   708448 Apr 23 01:09 docker-init

-rwxr-xr-x. 1 1000 1000  1979949 Apr 23 01:09 docker-proxy

-rwxr-xr-x. 1 1000 1000 15272168 Apr 23 01:09 runc

复制可执行文件到指定目录

# cp docker/* /usr/bin/
ls -l /usr/bin/{containerd,containerd-shim-runc-v2,ctr,docker,dockerd,docker-init,docker-proxy,runc}

设置开机启动

# systemctl enable containerd.service docker.socket docker.service --now

Created symlink from /etc/systemd/system/multi-user.target.wants/containerd.service to /usr/lib/systemd/system/containerd.service.

Created symlink from /etc/systemd/system/sockets.target.wants/docker.socket to /usr/lib/systemd/system/docker.socket.

Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

设置开机启动   报错了

vim /etc/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 --data-root="/data/docker"
  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

创建文件

添加以上内容

/data/docker

建立这个文件夹

我这里配置的是/server/data/docker

 systemctl start docker

启动成功了

docker info

systemctl enable docker

设置开机自启

下载包

解压

复制

设置service

启动service

设置自启service

这是二进制包的安装方法

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

闽ICP备14008679号