0

I have a project which consists of several services which are defined in a docker-compose.yaml file.

When I run docker-compose up -d several docker images are created and then each service runs in its own container.

I have followed the steps here How to save all Docker images and copy to another machine in order to save the images so that I can use them on another customer PC.

I ran this to save the images:

sudo docker save $(sudo docker images | sed '1d' | awk '{print $1 ":" $2 }') -o  my_project.tar 

And I can load this by doing:

sudo docker load -i my_project.tar

This appears to have saved and loaded the images as I check with the following command and all the imaegs do appear with the correct names and tags:

sudo docker images

But at this point there are no contianers running. How do I actually start each container the same way they were started with the docker-compose up command when using the original project?

Harry Boy
  • 4,159
  • 17
  • 71
  • 122
  • 1
    So you need two things 1: tar file having multiple images 2: a docker-compose file to describe how each image should load. Ref: https://eking-30347.medium.com/exporting-multiple-docker-images-alongside-docker-compose-f2db5d4a1632 – Gupta Mar 09 '22 at 14:48
  • 1
    @Gupta yes this worked :) thanks very much you are THE MAN!!!! – Harry Boy Mar 09 '22 at 17:27

1 Answers1

1

The important part of this is that you must have copy the docker-compose.yml file to the target system.

So you need two things

1: tar file having multiple images

2: docker-compose file to describe how each image should load.

Ref: Exporting Multiple Docker Images Alongside Docker-Compose

Gupta
  • 8,882
  • 4
  • 49
  • 59