Replies: 6 comments 1 reply
-
For Docker Desktop, you could use host.docker.internal:82 Not entirely sure (I use docker desktop) but with docker engine, it would be "add-host" with the "host-gateway" flag for the NPM docker run command (or for its compose file, it would be the "extra_hosts" element) to achieve a similar result, sources here and here |
Beta Was this translation helpful? Give feedback.
-
I use Portainer. Are you suggesting |
Beta Was this translation helpful? Give feedback.
-
Yes, but only if Docker Desktop is the docker software managing the containers. Otherwise, it means the software would be the "regular" docker engine (as it apparently seems to be your case, I use docker desktop in Windows) and for that scenario it would be that additional host parameter provided during container creation. Are you using a compose file or a docker run command to create the NPM container? |
Beta Was this translation helpful? Give feedback.
-
Portainer handles the containers with it's "stacks" so I'm guessing the answer to your question is Compose. |
Beta Was this translation helpful? Give feedback.
-
Yes, sorry about that - I should have edited my previous reply to include a mention of where in portainer each of those 2 methods is covered by. I gave it a try myself but had only partial success (I just created a new proxy host pointing to an existing service, the original proxy host uses host.docker.internal which is available to me on account of Docker Desktop), here is what I did so far: Adding this "extra_hosts" to the compose file:
Resulted in this additional name resolution (note the 2nd curl) being available from within the NPM container: I wrote partial success because despite of curl working as expected inside the container, I am getting a 502 error when I hit the new proxy host using my web browser 🙄. Later I will troubleshoot some more or try to bring some brand new web service up and check again. |
Beta Was this translation helpful? Give feedback.
-
Adding
...to the compose file (Portainer stack), Portainer fails to start the container. |
Beta Was this translation helpful? Give feedback.
-
My NPM runs in a Docker container and is on the same Docker network as other containers. I also have Apache installed directly on the same host server; non-dockerized. How can I create a NPM proxy host that proxy's traffic to Apache (localhost:82). I'm getting 502's because NPM is on the Docker network.
Beta Was this translation helpful? Give feedback.
All reactions