Closed riquito closed 9 years ago
+1
+1 for reopening or different solution without volumes.
Currently using Environment variables in docker-compose.yml and j2 in docker-entrypoint.sh for parsing them to configuration files before running the main app of the container. Works for me, though it's a custom image and it can't be used out of the box with already available complete images.
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1 for reopening
To add the possibility to have a different yaml file for each container instead of a config based on environment variables
+1 very needed feature
+1 , nice to have feature!
+1
+1
+1
+1
+1 reopening. Bookmarked
+1 this is a much-needed feature.
If there was some way to mark a shared volume as a layer, so the volume remained RO but the writes applied to a layer atop, I'd live happily without a copy
directive. I'd like to share, for example, an extracted build artifact, but the service writes to that directory (logs or PID file, etc.).
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1 For reopening as it would be a very useful feature
Maybe the template feature of https://github.com/jwilder/dockerize can help some of you
+1
+1
+1
+1
+1
+1 to reopen the issue
+1
Use docker secrets, in this example secrets are used with nginx image to copy server certificat and the config file https://docs.docker.com/engine/swarm/secrets/#intermediate-example-use-secrets-with-a-nginx-service
That's a good point. Honestly it seems that since we already have secrets, we should have copy, as secrets are, in a way, just a specific type of file that you would copy over. Namely, one which is more carefully provisioned, which we don't need for config files.
It beats host mounting a volume for every configuration file you want included.
As said before:
... volumes:
The reason copy is better, a) in swarm environments, where hosts are in fact separate machines, you should not have to have the exact same file in the same place on every machine. b) Copy can also be restricted to the folder compose is in, whereas a host mount requires an absolute path. c) I think the point of docker is to minimize the number of places that the contained application breaks into the host. Host mounts, even when configured as read-only, create a responsibility on the host to have and preserve files. We shouldn't have to use host mounts to solve this simple problem.
I think copying could be modeled similarly to the docker build
process, where the Dockerfile
is usually shipped in a git repository, along with all the files it needs to send to the build context. The Dockerfile
isn't permitted to send anything that exists outside of it's directory structure, even if it's symlinked correctly. We could have a similar thing with compose, where src
is restricted to the directory (and those below) of the docker-compose.yml
. Basically, the workflow would be, docker-compose
creates the container, and then for every src:dst
pair, find the src
under the current directory, and copy it into the unstarted container, then start the container.
Currently, avoiding host mounts can be achieved by adding additional Dockerfiles
and building the conf
files into amended images, but this seems like overkill to me, as it involves retagging a new image, or forcing users to use docker-compose
build
attribute instead of the more preferable (IMO) image
attribute. If you're already using the build
attribute in your service definition, and you want to do things this way, you are forced to pollute your otherwise agnostic image builder with a highly opinionated configuration file that should just belong to compose and the deployment process.
+1 for docker-compose copy feature
+1
+1
+1
+1 for copy.
+1 for docker-compose copy feature. I think the arguments in favor above are compelling.
+1 for copy
+1 for copy.
Although in my POV. It can become handy but it can also become out of control or abused for many users and can even make volume obsolete. If you just need files to be put onto the container especially for swarm then you can just use configs or secrets; But for my case like putting static folders in a nginx container, I have to use multi-stage builds in my Dockerfile to put those static folders in the container which takes a lot of process before my goal is achieved. So I think adding a copy option could be very useful
I want to deploy different services using the same image but with a different configuration file. Currently to achieve that I can
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: