离线主机中docker镜像文件的下载与安装

本文介绍了如何在Linux系统中启动Docker服务,拉取Nginx镜像文件至本地,以及如何将镜像保存为离线包并在另一台离线主机上安装。
摘要由CSDN通过智能技术生成
启动docker,并拉取nginx镜像文件
# 查看docker进程
[root@localhost docker]# docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
# 启动docker并设置随机自启
[root@localhost docker]# systemctl enable docker --now
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
# 拉取nginx镜像文件
[root@localhost docker]# docker pull nginx:1.20.2
1.20.2: Pulling from library/nginx
214ca5fb9032: Pull complete 
50836501937f: Pull complete 
d838e0361e8e: Pull complete 
fcc7a415e354: Pull complete 
dc73b4533047: Pull complete 
e8750203e985: Pull complete 
Digest: sha256:38f8c1d9613f3f42e7969c3b1dd5c3277e635d4576713e6453c6193e66270a6d
Status: Downloaded newer image for nginx:1.20.2
docker.io/library/nginx:1.20.2
保存nginx镜像为离线包,离线包在当前目录下
[root@localhost ~]# docker save -o nginx-1.20.2.tar nginx:1.20.2
上传nginx离线镜像包到离线主机
离线主机安装镜像文件,形成nginx镜像
[root@localhost ~]# docker load -i nginx-1.20.2.tar 
fd95118eade9: Loading layer [==================================================>]   83.9MB/83.9MB
c2a3d4a53f9a: Loading layer [==================================================>]  61.98MB/61.98MB
a64d597d6b14: Loading layer [==================================================>]  3.072kB/3.072kB
4f49c6d6dd07: Loading layer [==================================================>]  4.096kB/4.096kB
881700cb7ab2: Loading layer [==================================================>]  3.584kB/3.584kB
07ef16952879: Loading layer [==================================================>]  7.168kB/7.168kB
Loaded image: nginx:1.20.2
查看镜像是否存在
[root@localhost ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
nginx        1.20.2    0584b370e957   23 months ago   141MB
其他离线镜像包如上操作即可,适合内网主机使用
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值