PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, May 15, 2022

[FIXED] How to start docker containers using images loaded from another server?

 May 15, 2022     containers, docker, docker-compose, ubuntu     No comments   

Issue

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?


Solution

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



Answered By - Gupta
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing