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

Using service names in docker swarm #3711

Open
FlyingPersian opened this issue Apr 19, 2024 · 1 comment
Open

Using service names in docker swarm #3711

FlyingPersian opened this issue Apr 19, 2024 · 1 comment

Comments

@FlyingPersian
Copy link

Hello,

I'm struggling to configure npm proxies using service names in docker swarm.

I've put NPM and my other services into the same overlay network. To test if it's working, i entered the container's console and pinged NPM successfully. Then, I created a proxy and used the same hostname I pinged earlier to setup the proxy. When I go to the URL, it gives me a 502 Bad gateway. When I used the IP instead of the hostname, it works.

What can I do to fix this? Is this even possible on docker swarm?

I found similar instructions on the NPM website: https://nginxproxymanager.com/advanced-config/

Somebody else described the process for docker swarm on reddit: https://www.reddit.com/r/selfhosted/s/GlNMq5YuI4

@gratiachristi95
Copy link

Use container service name and then put .localhost after it. I would suggest against doing it this way for security purposes. You should put it on a separate docker network so that your containers are isolated by networking. Here is the link That explains some best practices:

https://medium.com/container-chronicles/the-fundamentals-of-container-networking-best-practices-and-key-considerations-ebc3c8bf2691

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

2 participants