How to ensure that my docker image / container will still work 100 years from now?

Viewed 80

I have created my Docker compose and Dockerfile but as you can see I am downloading PHP from Docker Hub and also downloading and installing PHP extensions. But what if after 20 years those images / packages will no longer be hosted on Docker hub? What if I want to still be able to run my container then?

Can I somehow freeze my containers in time? Can I bundle it all together so that if I come back to it 100 years from now and run my image it will still work? I don't want it to go out and download anything from the internet. I want to download everything now and just run it in the future.

Docker compose file:

version: '3'
services:

  php:
    build:
      context: ./php
      dockerfile: Dockerfile
    image: digitalocean.com/php
    container_name: php

And my PHP Dockerfile:

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
2 Answers

Well, yes. When you build a docker image it stores locally on your host machine. As your image already includes everything you need. You can store it in private docker registry and it will work even after 100 years

You'll need to provide them yourself

If not available in the future you will need to get and save them now by either:

  • Creating images that have download the packages now and saved them locally.

  • Download the packages now and set up a local server to serve them up as needed in the future.

Related