大家好,又见面了,我是你们的朋友全栈君。
docker离线安装方法
下载地址:https://download.docker.com/linux/static/stable/x86_64/
参考文档:https://docs.docker.com/engine/install/binaries/
机房设备无法访问互联网原因,需要进行离线安装
K8S 生态周报| Docker和containerd 全版本漏洞公布,近期在 Docker 中发现了一个 影响所有版本的安全漏洞
CVE-2022-24769
,该漏洞已经在 Docker 最新的版本 v20.10.14 中修复。建议安装docker-20.10.14 最新版本
一、安装docker
1.下载 Docker 二进制文件(离线安装包)
<code style="margin-left:0">wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.14.tgz</code>
2.通过mobaXterm
等工具上传到服务器
3.解压安装包
<code style="margin-left:0">tar -zxvf docker-20.10.14.tgz</code>
4.将docker 相关命令拷贝到 /usr/bin
<code style="margin-left:0">cp docker/* /usr/bin/</code>
5.docker注册成系统服务
<code style="margin-left:0">vim /etc/systemd/system/docker.service</code>
<code style="margin-left:0">[Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com After=network-online.target firewalld.service Wants=network-online.target [Service] Type=notify ExecStart=/usr/bin/dockerd ExecReload=/bin/kill -s HUP $MAINPID LimitNOFILE=infinity LimitNPROC=infinity TimeoutStartSec=0 Delegate=yes KillMode=process Restart=on-failure StartLimitBurst=3 StartLimitInterval=60s [Install] WantedBy=multi-user.target</code>
6.添加执行权限
<code style="margin-left:0">chmod +x /etc/systemd/system/docker.service</code>
7.重新加载配置文件(每次有修改docker.service文件时都要重新加载下)
<code style="margin-left:0">systemctl daemon-reload</code>
8.启动服务
<code style="margin-left:0">systemctl start docker</code>
9.设置开机自启
<code style="margin-left:0">systemctl enable docker.service</code>
10.查看状态
<code style="margin-left:0">systemctl status docker</code>
11.查看Docker版本
<code style="margin-left:0">docker -v</code>
二、测试hello测试
1.配置镜像加速器,使用中科大镜像加速器
<code style="margin-left:0">tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"] } EOF</code>
2.刷新配置
<code style="margin-left:0">systemctl daemon-reload</code>
3.重启docker
<code style="margin-left:0">systemctl restart docker</code>
4.拉取镜像
<code style="margin-left:0">docker pull hello-world</code>
5.查看镜像
<code style="margin-left:0">docker images --- REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest feb5d9fea6a5 6 months ago 13.3kB</code>
6.运行镜像
<code style="margin-left:0">docker run hello-world --- Hello from Docker! This message shows that your installation appears to be working correctly.</code>
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/189271.html原文链接:https://javaforall.cn
未经允许不得转载:木盒主机 » docker 离线安装_docker 离线安装