-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Introduce either format
or save
option to Compose v2 to save images in a compose project as tar balls
#9471
Comments
👍 it would be interesting to evaluate if we can offer the equivalent for |
I am of the opinion that a $ 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 |
@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 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:
docker save -o myStack.tar $(docker images --format "{{.Repository}}:{{.Tag}}")
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:
docker save -o myStack.tar $(docker compose images -q)
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
:The text was updated successfully, but these errors were encountered: