Skip to content
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

network name substitution #40819

Closed
burtsevyg opened this issue Apr 15, 2020 · 4 comments
Closed

network name substitution #40819

burtsevyg opened this issue Apr 15, 2020 · 4 comments

Comments

@burtsevyg
Copy link

Network name substitution does not work.
Please, see details in:
https://devops.stackexchange.com/questions/6317/docker-compose-yml-make-network-name-configurable-via-environment-variable

@cpuguy83
Copy link
Member

Does is perport to support name substituion?
Is this a feature request, bug report, doc fix request?
In the future please fill in the details requested in the issue template.

In any case, docker-compose is in https://github.com/docker/compose, so closing this here. Please open on the compose repo with all the relevant details.

Thanks!

@burtsevyg
Copy link
Author

This is docker swarm problem in my case.

@cpuguy83
Copy link
Member

Can you report to github.com/docker/cli?

@thaJeztah
Copy link
Member

thaJeztah commented Apr 23, 2020

I think this should be possible already if you use the name property for the network.

In that case, the name you reference the network as (within the stack) will be fixed, but the name of the actual network that's created will be customized.

Something like this;

networks:
  mynetwork:
    name: ${STAGE_NAME}
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: ${STAGE_NETWORK_PREFIX}.0/24

Inside the compose file, you'd reference the network as "mynetwork", but docker network ls will show the custom name. Take into account that that name is not "namespaced" (i.e., not prefixed with the stack name), so multiple stacks using that same custom name could collide

ookla-ariel-ride added a commit to ookla-ariel-ride/dockserver that referenced this issue Nov 19, 2021
network name substitution doesn't work in docker compose.  see moby/moby#40819 (comment)
ookla-ariel-ride added a commit to ookla-ariel-ride/dockserver that referenced this issue Nov 19, 2021
network name substitution doesn't work in docker compose.  see moby/moby#40819 (comment)
ookla-ariel-ride added a commit to ookla-ariel-ride/dockserver that referenced this issue Nov 19, 2021
network name substitution doesn't work in docker compose.  see moby/moby#40819 (comment)
doob187 pushed a commit to dockserver/dockserver that referenced this issue Nov 19, 2021
network name substitution doesn't work in docker compose.  see moby/moby#40819 (comment)
github-actions bot pushed a commit to ookla-ariel-ride/dockserver that referenced this issue Nov 19, 2021
network name substitution doesn't work in docker compose.  see moby/moby#40819 (comment)
github-actions bot pushed a commit to ookla-ariel-ride/dockserver that referenced this issue Nov 19, 2021
network name substitution doesn't work in docker compose.  see moby/moby#40819 (comment)
doob187 pushed a commit to dockserver/dockserver that referenced this issue Nov 19, 2021
network name substitution doesn't work in docker compose.  see moby/moby#40819 (comment)
github-actions bot pushed a commit to ookla-ariel-ride/dockserver that referenced this issue Nov 19, 2021
network name substitution doesn't work in docker compose.  see moby/moby#40819 (comment)
doob187 pushed a commit to dockserver/dockserver that referenced this issue Nov 19, 2021
network name substitution doesn't work in docker compose.  see moby/moby#40819 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants