13

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?

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Paul Oskar Mayer
  • 1,107
  • 1
  • 10
  • 22
  • Add the dockerfiles to your zip too and reference the image build from the right dockerfile in your docker-compose.yml? – lvthillo Mar 20 '18 at 14:18
  • but then i would have to deliver the complete source code with it? – Paul Oskar Mayer Mar 20 '18 at 14:20
  • True, if you don't want that you can .tar your images and put it in a zip with your docker-compose.yml. Provide it to someone who needs to unzip it and untar the image and just reference the image name in docker-compose? For me it seems to work like the answer here: https://stackoverflow.com/questions/46032392/docker-compose-doest-allow-to-use-local-images – lvthillo Mar 20 '18 at 14:23
  • but then you have to docker load every single image by hand or not? – Paul Oskar Mayer Mar 20 '18 at 14:26
  • You can script it to save all images in one .tar so you only need to untar that one (here all images are saved in one .tar https://stackoverflow.com/questions/35575674/how-to-save-all-docker-images-and-copy-to-another-machine) – lvthillo Mar 20 '18 at 14:30

2 Answers2

8

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
yamenk
  • 46,736
  • 10
  • 93
  • 87
  • 11
    I did `docker import`of both my containers. But, `docker-compose up` still trying to rebuild images. But I want just use imported. What I am doing wrong? – Ivan Burlutskiy Jul 25 '18 at 21:37
  • did you find a solution ? – Anis Smail Jul 29 '21 at 13:18
  • 4
    @AnisSmail Using `docker load < image.tar` instead of `docker import image.tar` will do the trick. You can confirm whether the image has been loaded with the correct tag by checking the output of `docker image ls`. – Scholar Nov 27 '21 at 18:03
  • 3
    for SAVED images u should use `docker load --input image.tar` – Demetry Pascal Jan 20 '23 at 21:16
-3

Try to export zip the plesk onyx docker.

Use this code:

<code>
FROM wpcache
MAINTAINER wpCache® support@wpcache.co

ENV WPCACHE_VERSION="2.0"

# download wpcache
RUN curl -O "https://github.com/wpCache/wpCache/raw/master/version/2.0.zip"

# unarchive wpcache
RUN unzip 2.0.zip
</code>
finde PATH PLESK  exoport  zip export per domain

how to make dir  main root   example:  domain.com /wpCache

docker export zip   /wpCache
jkdev
  • 11,360
  • 15
  • 54
  • 77