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
Specify network name in docker-compose file #3736
Comments
for overlay network: |
@vingrad does it work for overlay network only? |
no, but for other networks you need to use othe syntax: https://docs.docker.com/compose/compose-file/#/networks |
@vingrad resulting network name is project name + _ + network name in compose file. Is it possible to set resulting network name? |
@ivstas If you want full control over the network name, create it yourself and then reference it as networks:
custom_network:
external:
name: custom_network_name |
@aanand I know about this opportunity. Also, the same could be told about container names, but we do have an opportunity to set container name in compose file, right? |
Yes, but I don't think adding that was a good idea. |
@aanand Why is that? Aliases work fine for most cases but a Kerberos client, for example, uses reverse DNS Lookup to figure out the canonical hostname of a service, and reverse DNS lookup always yields |
Yeah, it will be quite useful.
|
I have two projects one is started using docker run ( with systemd ) and other one is started using docker-compose How am I suppose to put them both on the same network? |
@tarach I think this answers your question: https://docs.docker.com/compose/networking/#using-a-pre-existing-network |
Yes, I was thinking more of a way of setting the default network for docker-compose. Since I was unable to set bridge network in docker-compose because it apparently is for user defined networks only I've obviously created a network and assigned it to both d run and d-compose. |
I think allowing a network to be named, like Our workaround for solving this use case at my company is to wrap docker-compose in a shell script. Essentially: create_docker_network_if_exists $NETWORK
docker-compose "$@" Which is invoked with: If any core devs are able to provide me with context on what should be taken into consideration re: implementing a solution, then I'd be more than happy to submit a PR. |
And this is a another example of small features request that are demanded by users but "implicitly wontfix" because it seems not valuable for devs... 😕 For me
Adding configurable network name is absolutely the same business-case that |
What the progress on this? Also need this feature, it's like Here is the case: each application can consist of several microservices, so each application can have own docker-compose file, but all applications lives in one network. |
Fixed by #5448 |
Make sure that you're using |
Thx for the feature |
I am using network alias for this container is there any way to provide that in here? |
Specifying exact docker network name is not available in the docker-compose version present on google cloud machines. This can and should be replaced with a docker-compose directive once file format 3.5 is usable on the instances [1]. [1] docker/compose#3736
Specifying exact docker network name is not available in the docker-compose version present on google cloud machines. This can and should be replaced with a docker-compose directive once file format 3.5 is usable on the instances [1]. [1] docker/compose#3736
Specifying exact docker network name is not available in the docker-compose version present on google cloud machines. This can and should be replaced with a docker-compose directive once file format 3.5 is usable on the instances [1]. [1] docker/compose#3736
Specifying exact docker network name is not available in the docker-compose version present on google cloud machines. This can and should be replaced with a docker-compose directive once file format 3.5 is usable on the instances [1]. [1] docker/compose#3736
Best answer. |
I use version 3.5 and I get that property name was unexpected.
|
I use 3.5 version as well and i get the same error as @onzag
|
@juan-montilla Can you post your full compose file and the docker version? I just tested with Docker version 19.03.8 and a compose file version of 3.8 on macOS and it worked. |
@fishtenors sure!
I do not know if relevant.. but i am using Ubuntu 18.04 |
@juan-montilla Your compose file worked for me. Since you're using Docker 19.03+, you could try bumping the version up to 3.8. But that's just taking a stab in the dark. What version of compose are you running ( |
Is it possible to provide ability to set a name for network in docker-compose file?
Like this:
Thanks in advance!
The text was updated successfully, but these errors were encountered: