-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: Make net
and volumes_from
's container/service support explicit
#2501
Comments
One other solution I forgot to mention: similar to how we have two separate config keys - |
I also like option 2 |
This can now be closed:
|
Can somebody explain the documentation on this? https://docs.docker.com/compose/compose-file/ says:
So in my app's docker-compose YAML file, I was trying Are you guys saying this shouldn't be in the documentation? |
The documentation isn't published yet for 1.6. The problem you're hitting isn't related. Those options are not compatible. Using the network stack from a container means it uses the hostname from the container, so you can't try setting it to something else. Services will join the same network by default in compose 1.6, and in 1.5 with --x-networking |
Right now, you can put both service and container names in
volumes_from
:Compose will interpret the
data
entry involumes_from
as referring to thedata
service, and thesomething-else
entry as referring to an already-created container.The same is true of
net
: you can typenet: "container:<container-name>"
ornet: "container:<service-name>"
.This is error-prone: if you mistype a service name, you'll get an error saying that no such container exists, which is misleading. Furthermore, it makes it harder to tell what's going on for someone who's not aware that you can mix container and service names.
We should make the distinction explicit.
net
In the case of
net
, I thinknet: "container:<service-name>"
should becomenet: "service:<service-name>"
. Both uses ofnet
are uncommon, so we needn't make them especially concise.volumes_from
In the case of
volumes_from
, it's less obvious what to do:container:
orservice:
.container:
, and un-prefixed names are assumed to be service names. This is probably how most people usevolumes_from
, so it makes sense to make the default case more concise.service:
, and un-prefixed names are assumed to be container names. This means that the container name case maps to the Docker CLI's--volumes-from=container-name
flag, but also means that most users will have to do more typing.I personally like option 2 best.
The text was updated successfully, but these errors were encountered: