0

I used docker-compose to create an app that is composed by three images. I would like to understand now how can I export this app with the all services included.

Just for clarification the containers and images are the following:

container ls -a
CONTAINER ID   IMAGE
82522c850e9c   docker-app_client
7c796b6629bb   docker-app_server
66c84b58da2b   mongo

docker images
docker-mice-tracking-app_server
docker-mice-tracking-app_client
mongo

I can start my application from the folder in which i build the docker images by typing docker-compose up.

How can I export this images and replicate the same behavior on a different machine?

Thank you.

ceradini
  • 455
  • 1
  • 3
  • 11
  • Push all your images to a docker registry. Use the same images in your compose file. Store the compose file in a version control system (optional). On whichever system you want to have this set up, clone the repo which contains the compose yaml and do a compose up which will pull and deploy the containers – abhishek phukan Jul 12 '21 at 16:45

2 Answers2

3

Couple of ways here.

  1. Store all images in a docker registry. For this you need to tag and push the images. Once you have that done , copy over the compose file to the new machine and run the docker-compose up. Note that you will have to change the image name on your compose to reflect the images you had retagged in order to be able to pull them down.

  2. If you do not have access to a docker registry , you can save the docker images using a docker save command which will create a tar file of those images. Copy those tar files over to a new system and do a docker load to load them as images from the tar file. Once done , you can run the docker compose command to deploy them on the new system

abhishek phukan
  • 751
  • 1
  • 5
  • 16
0

I think you can push your images onto a docker registry by using

docker push

Then from other machines, you pull the images and run it.

The documentation is here

HNK
  • 1