This would be a nice feature for creating and deploying of containers on a different (development) machine than the productive ones (which may run via image: option)
Some related issues #213, #457
I would give this a +1 as either an addition to docker-compose or as part of a different "build tool".
In addition it would be nice (and UNIXy) to add an "images" verb, so as to output a flat list of the images built by the tool.
I'm thinking things like this would be possible:
$ docker-compose build
$ docker-compose images | while read i; do docker save $i -o $i.tgz ; done
Thoughts?
[Addendum] Additionally, this would perhaps solve the problem of pushing?
$ docker-compose images | while read i ; do docker push my.registry.server:5000/$i ; done
+1
docker-compose is the best/easiest way to build a bundle of related docker images. Being able to easily push these resulting docker images to a registry is a natural extension of this workflow. My use-case is a development use-case where a bundle of images are built by Jenkins. I'd like to be able to easily push these images somewhere for developers to pull and use/run.
:+1:
+1
+1
+1
+1 (and another +1 for a vote feature in github)
+1
+1
+1
+1
+1
+1
+1
:+1:
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
cy8aer opened this Issue on Mar 17, 2015
Any progress/updates? We have swarm today. In my opinion this is not anything someone wants. Today this is something docker-compose really needs.
Tried building images somewhere in swarm? Doesn't make fun. Having two distinct compose YAMLs, one to build the image, still not being able to push it with compose, another YAML to deploy the service (, again somewhere in swarm).
Assumption on a 100 peer swarm cluster, one would be forced to
In my opinion, people wants a solution to the problem of: build the Dockerfile
of a service and then push the image to some registry and update the docker-compose.yml
.
When other developers want the updated images, They don't have a solution like: pull my new docker images and start my services again, They need to update their docker-compose.yml
or build the image on their machines.
NOTE: I don't know if compose is the best tool to do this job or if this way is not considered a "good practice".
We also need a way to do either docker-compose push service
or docker-compose image service
.
Since you can use a .env
file now, it's pretty nice to define the image to be built there. But you need to manually parse it, when you want to use it with docker push
, like so:
# workaround for docker-compose environment variables
export $(cat .env | grep -v ^# | xargs)
docker push ${IMAGE_NAME}${IMAGE_TAG}
+1
+1
+1
It seems that this feature is no-longer needed with the creation of the captain tool?
Compose 1.8 currently available as RC2 has added docker-compose push
for pushing images created by docker-compose build
. It's not a flag on build, but it should provide the requested functionality.
Since harbur/captain was mentioned above, I thought I might also mention dobi. It's a different take on the same problem of automating build tasks with docker (build, test, push, etc).
Interesting, thanks for the reference to dobi. It looks like it handles tagging and test targets better than captain, but no registry pushing.
Thanks,
Jason Mills
On Jul 26, 2016, at 6:26 PM, Daniel Nephin [email protected] wrote:
Since harbur/captain was mentioned above, I thought I might also mention dobi. It's a different take on the same problem of automating build tasks with docker (build, test, push, etc).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
You can push to a registry with an image:push task. There's no official examples of this just yet, but you would create an alias
and put <resource_name>:push
as one of the tasks, or run dobi <resource_name>:push
from the command line to push an image.
For example, I use DOBI_VERSION=0.4 dobi dist-img:push
to push the official dobi image to the hub.
The config is here: https://github.com/dnephin/dobi/blob/b07d8b124/dobi.yaml#L34-L37
Not to derail this thread, but how does that work with private registries? Prefix the image name with the registry address?
Thanks,
Jason Mills
On Jul 26, 2016, at 6:54 PM, Daniel Nephin [email protected] wrote:
You can push to a registry with an image:push task. There's no official examples of this just yet, but you would create an alias and put
:push as one of the tasks, or run dobi :push from the command line to push an image. For example, I use DOBI_VERSION=0.4 dobi dist-img:push to push the official dobi image to the hub.
The config is here: https://github.com/dnephin/dobi/blob/b07d8b124/dobi.yaml#L34-L37
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
+1
+1
+1
+1
+1
So can someone explain the status of this proposal? @aanand @Vanuan @michael-k
And actually after this I just went through these two topics also: Deploying a registry server and #3900 - Docker compose pull does not work with custom registry
It's a bit hard to understand, since docker has both the abilities 'running a registry server' and 'docker-compose(pull)', why not integrate these two seamlessly?
But still recommend this proposal: just integrate with a well-known service providers, like Github, Bitbucket, AWS, Google Cloud, Azure etc, running own registry server the speed, security gonna be some serious problem/bottleneck.
+1
you can now choose the image name & tag when building a service:
If you specify image as well as build, then Compose names the built image with the webapp and optional tag specified in image:
– https://docs.docker.com/compose/compose-file/#build
this name is then used when using docker-compose push
that mean you do something like this:
services:
service:
build: .
image: registry.acme.com/acme/service:latest
and it works !
# docker-compose push
Pushing service (registry.acme.com/acme/service:latest)...
The push refers to a repository [registry.acme.com/acme/service]
If I push 3 services to a private repository using this method and a single docker-compose.yml, can I docker-compose pull all three services with just one command, or do I need to pull them all back separately?
@wayoung you can simply 'docker-compose pull' to pull all the remote images
That only works if I am in the same directory as the docker-compose.yml. I'm thinking of the case where I docker-compose push to the registry, then try to pull it down on another machine without the original docker-compose.yml. Is that possible?
@wayoung
How it's supposed to know which images you're trying to pull without any information provided by you?
You'd still need compose file to start services, why won't you just copy it?
Issue grooming: According to https://github.com/docker/compose/issues/1126#issuecomment-235454500 this was fixed (by providing docker-compose push
) in 1.8 rc2. Therefore closing.
Most helpful comment
you can now choose the image name & tag when building a service:
– https://docs.docker.com/compose/compose-file/#build
this name is then used when using
docker-compose push
that mean you do something like this:
and it works !