-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Allow using wildcards in Docker-Compose network > aliases #7493
Comments
anyone aware of a workaround for this? |
The way I'm doing it right now is manually putting each app's URL in there. |
Workaround: set up a dnsmasq container for hosting the wildcard entries, then point other containers' dns at that container. Caveats:
Example config: https://gist.github.com/NAR8789/92da076d0c35b434107fb4f4f198fd12 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Bump! (I didn't want this issue to get auto-closed). This feature would be extremely helpful due to the fact that our dockerized app requires knowing the domain, and it uses sub-domain based multi-tenant routing. Our work around was to put all the common URL's in the network aliases. It works but its not ideal because we have many dozens of subdomains we'd like to actually include. Example of what we have: networks:
my_network:
aliases:
- demo.local.ourdomain.com
- foo.local.ourdomain.com
- bar.local.ourdomain.com
- buzz.local.ourdomain.com |
This issue has been automatically marked as not stale anymore due to the recent activity. |
The solution posted with If you follow the steps posted by @NAR8789 then all you need to do is add the I use |
The It would still be great if Docker Compose natively supported wildcard aliases though. It would alleviate this extra complexity in the compose file. |
I think it's not docker-compose's issue but rather docker (or libnetwork). You can't achieve this kind of wildcard alias with plain docker CLI either. Opened moby/moby#43442 about this same problem. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Commenting to make sure the issue won't be closed. |
This issue has been automatically closed because it had not recent activity during the stale period. |
:( |
Please reopen this issue. It's still a requested feature and isn't stale. Pinging @docker staff for visibility @glours @nicksieger @ndeloof @StefanScherer @ulyssessouza @laurazard Edit: Please and thank you! |
This issue has been automatically marked as not stale anymore due to the recent activity. |
I need this feature too. However, I think it must be a feature of docker internal dns not docker compose. moby/moby#43444 |
Compose just passes the |
Closing this issue as "not planned". Obviously, if moby/moby#43442 get eventually fixed, we would add support in docker compose to support this usage. |
Is your feature request related to a problem? Please describe.
When setting up a Proxy service in Docker-Compose, I need to always define hostnames both in my hosts file and in
networks > [NETWORK_NAME] > aliases
.For instance:
frontend.myapp.localhost
api.myapp.localhost
I would like both domains to point at the proxy at whichever port I defined. This way, I can have multiple services running on the same port.
If my host machine targets
frontend.myapp.localhost
orapi.myapp.localhost
, because I have those domains setup in my hosts file, everything works fine.The problem occurs when everything is behind the proxy. For instance, I'm doing server-side rendering and
frontend.myapp.localhost
now tries to call out toapi.myapp.localhost
before sending me some HTML. All of a sudden, I need to be using the docker-compose container name ofapi
instead.The way I fix this is by assigning aliases on the docker-compose
proxy
app network:Describe the solution you'd like
*.myapp.localhost
instead of having to define each and every one.aliases
property.Either solution fits my needs, but #1 is far easier to implement. A combination of the two would be ideal because then anyone could use this proxy image and only need to ensure they're passing in a list of directories to check for configs.
Describe alternatives you've considered
Right now, I'm manually putting in every alias, but because my proxy app needs to be an independent repository, I have to manually add every possible alias by hand. In my case, that's 70+ applications to manage. If they change their URL, that's time I have to spend updating these local aliases.
Good luck to any dev that has to bisect older code in a different repo. It won't work if they changed the URL alias passed into the proxy.
The text was updated successfully, but these errors were encountered: