David
David

Reputation: 197

No response from server running in Docker container within LAN

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>

Testing connection to server on localhost while running inside of a Docker container

Testing connection to separate computer while running server in Docker container

Upvotes: 0

Views: 1820

Answers (1)

Matt
Matt

Reputation: 74851

The container will not be accessable external to the Linux host when listening on 127.0.0.1/localhost.

To bind to all available interfaces use:

docker run -p 3000:3000 <image>

Or specify the address of a publicly available interface from ip address show

docker run -p <public_ip>:3000:3000 <image>

Upvotes: 1

Related Questions