Open FlyingPersian opened 2 months ago
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:
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