Nick Vargas
Nick Vargas

Reputation: 71

Docker container inaccessible from host

I am trying to get a tomcat application server running on a docker container. The server is working, but I cannot access it from the host machine.

The command that I am running to start the container is

docker run -d -p 9080:9080 example/server 

On a shell within the container I can type

curl localhost:9080

to get a readout of what the server should yield. This works correctly. However, if I attempt this from the host machine I get the following error message:

curl: (56) Failure when receiving data from the peer

If I replicate the process with a normal Apache server, everything works as it should.

Upvotes: 4

Views: 1114

Answers (1)

Nick Vargas
Nick Vargas

Reputation: 71

I have solved this issue. The server was configured by default to use 'localhost' as the host which does not work properly with docker. I edited the configuration file to use host="*" and now everything works as it should.

Upvotes: 3

Related Questions