Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use image-file in docker-compose file

I have to deliver an application running in several containers to a customer.
I can export all single images to files with:

docker save --output app1.tar app2
docker save --output app2.tar app2
...

My goal is do deliver a ZIP-folder with only the docker-compose.yml and the images (app1.tar,app2.tar...) needed to run the containers.

Is there any way to reference an image-file in the docker-compose.yml?

like image 596
Paul Oskar Mayer Avatar asked Mar 20 '18 14:03

Paul Oskar Mayer


People also ask

Can we use Dockerfile in Docker compose?

The Dockerfile is used to build images while the docker-compose. yaml file is used to run images. The Dockerfile uses the docker build command, while the docker-compose. yaml file uses the docker-compose up command.

Does Docker compose up pull images?

That means docker-compose build will not build the buildchaintest docker image—it will just directly pull and run the docker image tag. Since docker-compose build doesn't attempt to build buildchaintest , there's no point to trying to tag or push that image after invoking it.

What does image in Docker compose mean?

image means docker compose will run a container based on that image. build means docker compose will first build an image based on the Dockerfile found in the path associated with build (and then run a container based on that image).


1 Answers

No you can't reference a tar ball from a docker-compose file.

You need to provide an addition script with the ZIP folder. This script would import the images, and start docker-compose. It can be more or less like below:

docker import app1.tar
docker import app2.tar
docker-compose up
like image 156
yamenk Avatar answered Oct 06 '22 23:10

yamenk