Now that docker-compose
v1 is deprecated in favor of docker compose
v2, and the Compose file build
section supports a tags
subsection, how can I use the old equivalent of docker-compose push
to push all the images? Say I have this example docker-compose.yml file:
---
version: "3"
services:
myservice:
image: myregistry.com/stuff/myimage:v1.0.0
build:
context: ./myimage
tags:
- myregistry.com/stuff/myimage:latest
If I follow docker compose build
with docker compose push
, only the v1.0.0 tag gets pushed. Is there an alternative other than falling back to docker push myregistry.com/stuff/myimage:latest
?
I was just investigating the same issue and happened upon your post.
As referenced in this post the code added to handle building with multiple tags was merged into docker compose on 05/23/2022 (so relatively recent). docker compose push
doesn't appear to respect that yet.
However, you can use the --all-tags
flag to docker push
to push all tags of an image which appears to accomplish close to the same objective.
-a, --all-tags Push all tags of an image to the repository
docker push --all-tags myregistry.com/stuff/myimage
Hope this helps!
UPDATE: For any future readers, docker compose push
now pushes all tags specified in image
and tags
sections to the registry.
docker compose push