4

With the native docker client daemon, you can save images to a file and then load them.

As an example, from the docs:

$ docker save busybox > busybox.tar
$ ls -sh busybox.tar
2.7M busybox.tar
$ docker save --output busybox.tar busybox
$ ls -sh busybox.tar
2.7M busybox.tar
$ docker save -o fedora-all.tar fedora
$ docker save -o fedora-latest.tar fedora:latest

I would like to do the same functionality using docker-compose. However, it doesn't appear to support save/load in their documentation.

The reason I would like to do this is I am running docker-compose in an environment where it communicates via the docker sock, but does not have docker itself installed. I cannot install a docker client in this environment (but docker-compose is installed). Docker is not installed and does not have to be installed for docker-compose to work. ALL docker-compose requires is a connection to /var/run/docker.sock and it uses docker-py to talk over this.

I guess I could write a simple script using docker-py to do this but I am hoping to do this through docker-compose itself.

Is there a way for docker-compose to load an image file saved with docker save or to do the equivalent command?

5
  • 1
    @SimonBoudrias that's not how docker-compose works. It communicates directly on the docker sock and does not require docker itself to be installed. Docker must be installed somewhere but does not necessarily have to be installed where docker-compose is.
    – enderland
    Sep 21, 2016 at 2:42
  • it just a schedule tool which consume the docker API I think, so for save, it still need use docker actually. Sep 21, 2016 at 2:48
  • 1
    Answers go in the answers, folks. Sep 21, 2016 at 2:52
  • 1
    @LipingHuang using docker-compose does not require docker installed in the environment you are using it. All it requires is a the ability to connect to the docker-api to a location a valid docker instance is working. This does not have to be in the same environment docker-compose is running in.
    – enderland
    Sep 21, 2016 at 2:54
  • Just a note on how docker API can be used to save an image: curl --unix-socket /var/run/docker.sock http://localhost/images/get?names=fedora >fedora.tar (requires curl >7.40) Sep 21, 2016 at 8:07

1 Answer 1

-2

Is there a way for docker-compose to load an image file saved with docker save or to do the equivalent command?

There is not. Your best option is to write a script with docker-py

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.