Open shantanoo-desai opened 2 years ago
👍 it would be interesting to evaluate if we can offer the equivalent for docker save / docker load
as compose commands for all service images
I am of the opinion that a --format
should be sufficient. Since compose
now is part of the docker
CLI using a combination of
$ docker save -o myStack.tar $(docker compose images --format="{{.Repository}}:{{.Tag}}")
should be sufficient. This gives the end user more usage benefits of filtering. Providing docker compose save
and docker compose load
would make sense if docker itself provided some isolation environment (think like python's virtualenv). Just an opinion though
@ndeloof any plans, updates or Roadmap for this feature request, if you want I can try my hands on it, given it complies with the team.
export
docker save -o test.tar $(docker compose convert --images)
....
load:
docker load < test.tar
docker compose up -d
hey, i would like to take up this issue if you won't mind. @ndeloof can i proceed? any kind guidance from your side :)?
I for one would love to see docker compose save
/ load
commands. Or rather, something akin to docker compose install
.
I believe my use-case is somewhat similar to the functionality as the now-defunct Docker App, in that I use Docker to deploy a rather large software stack on 3rd party machines.
A related feature would be to auto-run a container after loading. This container, with some sensible bind mounts, would be responsible for stack configuration (rendering templates to configuration files etc.). However, I reckon this is potentially somewhat out of scope for this feature request
Description Currently Docker Compose v2.5.0 provides a command call
docker compose images
which will list the images / containers within dedicateddocker-compose.yml
file.There is currently no way to use these
--format
option alongside with e.g.docker compose images --format="{{.Repository}}:{{.Tag}}"
in order to save the images as tarball.A common usage pattern with Docker CLI would be:
The above however requires to have a host with only the dedicated container images. In most if not all cases, host machine have many container images which may not be required in the compose project.
A potential introduction of either
docker compose images --format
would be useful to pack the images into a tarball without having to remove other containers outside a dedicated project or providedocker compose save
to achieve the same.Steps to reproduce the issue: Current method of creation of tar balls is:
This is a bit problematic, since
-q
only lists the Image IDs of the container. In situations where the tarball is loaded onto an offline machine with the dedicateddocker-compose.yml
file, upon triggeringdocker compose
will try to pull images from the Hub, because as standard usage each image in a compose file is always mapped with aname:version
as opposed to Image HashesDescribe the results you expected:
by using
docker compose save -o <tarballname>.tar
one would be able to save the imagesAdditional information you deem important (e.g. issue happens only occasionally):
Output of
docker compose version
:Output of
docker info
: