且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在不连接互联网的情况下运行docker映像?

更新时间:2022-11-03 10:52:19

您可以通过简单的方法通过从任何其他可以访问互联网的机器上导出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