I'm not sure if this is a networking issue, or a Docker issue, but I'm having a difficult time getting a response from a server on a separate machine in my LAN that is running a nodejs server on port 3000 in a Docker container. I'm using a Mac computer as a client, and a Linux computer as a server. These are the steps I've taken :
Testing connection to separate computer on LAN using <name of computer>.local:<port>
- Run server on Linux machine (just using nodejs without a container)
- On Mac (client) computer run
curl <name of linux computer>.local:3000 - Works as expected
Testing connection to server on localhost while running inside of a Docker container
- Run server on Linux machine inside of a container using the command
docker run -p 127.0.0.1:3000:3000 <name of image> - On Linux machine run
curl localhost:3000 - Works as expected
Testing connection to separate computer while running server in Docker container
- Run server on Linux machine inside of a container using the command
docker run -p 127.0.0.1:3000:3000 <name of image> - On mac machine run
curl <name of linux computer>.local:3000 - No response from server