Compose: Add labels in docker-compose run

Created on 19 Jun 2017  路  4Comments  路  Source: docker/compose

Currently docker-compose run has a bunch of flags you can use to override some configurations from the ones defined in the corresponding docker-compose.yaml file.

There's still the lack of a -l or --label parameter. This is way useful, I have a use case:

You have a host where there is a traefik inverse proxy and your production app is running. You boot a sidekick container that needs to keep on doing things in the background, so you run docker-compose run --rm app backgroundjob. At some point, you need to restart the production app, so you docker-compose restart app, and then suddenly the proxy returns a 404 status. That's because Traefik lost notion of your production container for a second, and then it routed things to the myproject_app_run_1 container instead. When the old production container is restarted, it has no longer routing.

If we were able to docker-compose run --rm -l traefik.enable=false app backgroundjob, this would never happen.

I guess there could be other possible similar scenarios out there.

arerun kinfeature

Most helpful comment

Hello. I'm currently an undergraduate student taking a course on virtualization. For our final project, my group of three is required to find an open-source issue to work on in our last three weeks. This issue sounded manageable for the time frame and our skill level. Is anybody already working on this and does this sound reasonable?
Thank you

All 4 comments

Hello. I'm currently an undergraduate student taking a course on virtualization. For our final project, my group of three is required to find an open-source issue to work on in our last three weeks. This issue sounded manageable for the time frame and our skill level. Is anybody already working on this and does this sound reasonable?
Thank you

Hello, is this still available? I ran docker-compose up --label but it doesn't seem that docker-compose==1.21.2 still has this option

This is for docker-compose run, not docker-compose up. Try that?

Ooh just noticed that, I'm sorry.

Was this page helpful?
0 / 5 - 0 ratings