离线主机中docker镜像文件的下载与安装 启动docker并拉取nginx镜像文件# 查看docker进程[rootlocalhost docker]# docker psCannot connect to the Docker daemon at unix:///var/run/docker.sock.Is the docker daemon running?# 启动docker并设置随机自启[rootlocalhost docker]# systemctl enable docker --nowCreated symlinkfrom/etc/systemd/system/multi-user.target.wants/docker.service to/usr/lib/systemd/system/docker.service.# 拉取nginx镜像文件[rootlocalhost docker]# docker pull nginx:1.20.21.20.2: Pullingfromlibrary/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 imagefornginx:1.20.2 docker.io/library/nginx:1.20.2保存nginx镜像为离线包离线包在当前目录下[rootlocalhost ~]# docker save -o nginx-1.20.2.tar nginx:1.20.2上传nginx离线镜像包到离线主机离线主机安装镜像文件形成nginx镜像[rootlocalhost ~]# docker load -i nginx-1.20.2.tarfd95118eade9: 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查看镜像是否存在[rootlocalhost ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE nginx 1.20.2 0584b370e957 23 months ago 141MB其他离线镜像包如上操作即可适合内网主机使用