Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何确保我的docker图像/容器在100年后仍然有效?_Docker_Docker Compose_Dockerfile_Containers - Fatal编程技术网

如何确保我的docker图像/容器在100年后仍然有效?

如何确保我的docker图像/容器在100年后仍然有效?,docker,docker-compose,dockerfile,containers,Docker,Docker Compose,Dockerfile,Containers,我已经创建了Docker compose和Dockerfile,但正如您所看到的,我正在从Docker Hub下载PHP,并下载和安装PHP扩展。但如果20年后,这些图像/包将不再托管在Docker hub上,该怎么办?如果我还想运行我的容器呢 我能及时冻结我的容器吗?我能不能把它捆绑在一起,这样,如果100年后我回到它,运行我的图像,它仍然可以工作?我不想让它出去从互联网上下载任何东西。我想现在下载所有东西,以后再运行 Docker编写文件: version: '3' services:

我已经创建了Docker compose和Dockerfile,但正如您所看到的,我正在从Docker Hub下载PHP,并下载和安装PHP扩展。但如果20年后,这些图像/包将不再托管在Docker hub上,该怎么办?如果我还想运行我的容器呢

我能及时冻结我的容器吗?我能不能把它捆绑在一起,这样,如果100年后我回到它,运行我的图像,它仍然可以工作?我不想让它出去从互联网上下载任何东西。我想现在下载所有东西,以后再运行

Docker编写文件

version: '3'
services:

  php:
    build:
      context: ./php
      dockerfile: Dockerfile
    image: digitalocean.com/php
    container_name: php
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
RUN docker-php-ext-install gd
和我的PHP Dockerfile

version: '3'
services:

  php:
    build:
      context: ./php
      dockerfile: Dockerfile
    image: digitalocean.com/php
    container_name: php
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
RUN docker-php-ext-install gd
你需要自己提供 如果将来不可用,您需要立即通过以下方式获取并保存它们:

  • 正在创建已下载软件包并在本地保存的图像

  • 现在下载软件包,并设置一个本地服务器,以便将来根据需要为其提供服务


  • 嗯,是的。构建docker映像时,它将本地存储在主机上。因为你的形象已经包含了你所需要的一切。
    您可以将其存储在private docker中,即使在100年后也能正常工作

    因此,当我运行
    docker build
    时,它将下载所有内容,稍后当我运行图像时,它将不再需要下载任何内容?是的。
    Dockerfile
    中描述的所有内容都将在最终的docker图像中持久化。好的,请澄清。如果我今天成功地树立了自己的形象,并在互联网不复存在的100年后回来。然后我仍然可以运行我的映像,但我无法重新构建它?另外,我要澄清的是,所有内容都保存在
    映像
    容器
    ?所有内容都保存在
    映像
    中<代码>容器只是跑步图像的一个实例。您可以保存容器的状态,但问题在于如何创建包含所有包的图像?