Access from another machine on the network - possible? #207
-
I'd like to run this on a headless server (a Pi currently running HypriotOS). If I set it up all seems to be running, but if I try and access the web UI from another machine I just get site cannot be reached rather than the UI. That's using 192.168.0.100:5000 rather than 127.0.0.1:5000 with ...100 being the Pi's IP address. Is there any way to set this up to work remotely from another machine? I also note in the logs via Portainer there is
Which may or may not be relevant, as it's just a warning? But the 0.0.0.0 looks a bit odd? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Not sure if you ever got this sorted, but this will be due to the Docker port mappings. When running the
The same goes for if you're using docker-compose. Regarding the logs, same as above, the 0.0.0.0 just means it will be listening on any IP address, port 5000. That's fine, because that is solely within the container, and is why the right side of our port mappings is always 5000;
If you want it accessible on a port that isn't 5000, for example 7000, you can change that on the left side and Docker will pass that on to the correct port inside the container e.g. Hope that helps. |
Beta Was this translation helpful? Give feedback.
-
Indeed it does help, works perfectly after rebuilding the container with that tweak. Many thanks for the pointer, kicking myself that I didn't actually notice it myself! |
Beta Was this translation helpful? Give feedback.
Not sure if you ever got this sorted, but this will be due to the Docker port mappings.
When running the
docker run
command;-p "127.0.0.1:5000:5000"
will bind to port 5000 on localhost on the host, so it will only be accessible from the same machine.This is good to use if you have a reverse proxy running on the same machine.
-p "0.0.0.0:5000:5000"
or just"5000:5000"
will bind to any IP on the host, and will therefore be accessible from other machines when visiting, per your example, 192.168.0.100:5000.The same goes for if you're using docker-compose.
Regarding the logs, same as above, the 0.0.0.0 just means it will be listening on any IP address, port 5000. That's fine, because that i…