如何在不连接互联网的情况下运行docker映像? [英] How run docker images without connect to Internet?

查看:160
本文介绍了如何在不连接互联网的情况下运行docker映像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在没有连接到Internet的系统中安装了 docker ,以便与 docker 一起运行映像,我必须从和其他系统下载一个简单的图像。然后,将此映像放在此路径的脱机系统中: C:\Users\Public\Documents\Hyper-V\虚拟硬盘

I have installed docker in a system which has no connection to Internet so to run an image with docker, I had to download a simple image from this and from another system. Then I put this image in my offline system in this path : C:\Users\Public\Documents\Hyper-V\Virtual hard disks

,但是当我在cmd中运行 docker run hello-world 时,会看到以下消息:

but when I run docker run hello-world in cmd I see this message:

Unable to find image 'hello-world:latest' locally

并尝试从Internet下载hello-world图像,但是它没有与Internet的连接,因此可以使用。现在我想知道应该将我的图像放在什么位置以便Docker可见?

and tries to download hello-world image form Internet but it has to no connection to the Internet so it field. Now I want to know where I should put my images in to be visible to docker?

推荐答案

您可以通过简单的方法通过从任何其他可以访问互联网的机器上导出docker镜像,而不会弄乱文件夹:

You can do it the easy way without messing around with folders, by exporting the docker image from any other machine with access to internet:


  1. 将镜像拖到

  1. pull the image on a machine with internet access.

$docker pull hello-world


  • 将该图像保存到.tar文件。

  • save that image to a .tar file.

    $ docker save --output hello-world.tar {your image name or ID}
    


  • 将文件复制到任何计算机上。

  • copy that file to any machine.

    将.tar文件加载到Docker。

    load the .tar file to docker.

    $docker load --input hello-world.tar
    


  • 签出:
    https:// docs.docker.com/engine/reference/commandline/image_save/
    https://docs.docker.com/engine/reference/commandline/load/#examples

    这篇关于如何在不连接互联网的情况下运行docker映像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆