Add `copy` to the yaml configuration
Problem
I want to deploy different services using the same image but with a different configuration file. Currently to achieve that I can - build as many images that inherit from a common image plus a different COPY in each - mount a single file volume The first solution isn't feasible and the second it's overkill. I just want to copy a file, not keep it in sync Proposed configuration: [code block]
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Add `copy` to the yaml configuration
Now that docker-1.8 added support for copy into a container via `docker cp` and swarm-0.4.0-rc2 added support for `docker cp`, it would be great to revisit this issue at the compose level. Here is the use case (which mirrors what we actually do in _almost_ production now): A docker-compose.yml file that mentions many containers by CI-built image tag (i.e. we don't use `build:` in production; ma
Trust Score
5 verifications
- 1
Now that docker-1.8 added support for copy into a container via `docker cp` and
Now that docker-1.8 added support for copy into a container via `docker cp` and swarm-0.4.0-rc2 added support for `docker cp`, it would be great to revisit this issue at the compose level. Here is the use case (which mirrors what we actually do in _almost_ production now):
- 2
A docker-compose.yml file that mentions many containers by CI-built image tag (
A docker-compose.yml file that mentions many containers by CI-built image tag (i.e. we don't use `build:` in production; maybe we could now but it didn't play nice with swarm in past releases) that all need e.g. static hadoop configuration files mapped in which exactly match the deployment environment. Currently, one must manually sync the directory in which docker-compose.yml resides to the exact path on _each_ target docker-machine in the swarm. Then one adds a stack of `volume:` lines.
- 3
Supporting `docker cp` would allow the removal of a custom configuration file sy
Supporting `docker cp` would allow the removal of a custom configuration file sync in our system deployment method and allow better control of when configuration changes are injected (since anyone changing the files mentioned in the `volume:` lines are affecting all prior deployed containers (and whatever time the internal implementations re-read said configuration, perhaps only upon the next container restart, perhaps when various tools inside the container start; which may be unexpected) and future (which is expected).
- 4
OTOH, (as mentioned briefly above) maybe we should use `build:`. The downside h
OTOH, (as mentioned briefly above) maybe we should use `build:`. The downside here is that we need to write an extra Dockerfile per deployment container type. One for the CI-built images and a second for the static configuration file injector. `copy:` in compose backed by the recent changes to `docker cp` would neatly allow us to avoid all this duplication.
Validation
Resolved in docker/compose GitHub issue #1664. Community reactions: 10 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep