0

I don't have much experience with Docker so not sure if this is even possible, but I'm trying to export my Docker containers as a single image.

I've created a web server using various images from the official repos (nginx, php7, postgresql). I have a docker-compose.yml file to start each container and link them.

There are volumes for the web hosting root directory and the postgresql data directories.

I now need to export this whole lot, including the volumes so that our technicians out in the field can easily install our web server on client networks. We generally do not have access to the internet on those PCs which is why I can't simply give them the compose and Dockerfiles.

Apologies if I'm not being clear but this is still pretty new to me.

web:
 image: nginx:latest

 environment:
  - DOCKER_WEB=true

 #stdin_open: true
 #tty: true
 ports:
 - "8080:80"

 volumes:
  - ./code:/code
  - ./default.conf:/etc/nginx/conf.d/default.conf

 links:
 - php

cron:
 build: './docker/cron'

 links:
 - web

throwaway:
 build: './docker/throwaway'
 volumes:
  - ./code:/code

php:
 #image: php:7-fpm
 build: './docker/php'

 links:
 - postgres

 volumes:
  - ./code:/code

postgres:
 image: postgres:latest

 environment:
  - POSTGRES_USER=un_rftags
  - POSTGRES_PASSWORD=pwd_RFT@gs01
  - POSTGRES_DB=db_rftags

 volumes:
  - ./postgres-data:/var/lib/postgresql/data

 ports:
 - "9090:5432"

1 Answers1

0

You can save all your images at once with docker save, and then import them on the destination system with docker load.

This means, of course, that you need to create images, but you seem to be doing that already.

For example:

docker save nginx:latest cron throwaway php | xz -c > all-images.tar.xz

Import them to the destination docker with:

xz -dc < all-images.tar.xz | docker load
Michael Hampton
  • 237,123
  • 42
  • 477
  • 940