2

I have started a docker container using the command

sudo docker run -it -P -d plcdimage 

The image is built using a Dockerfile which has instruction EXPOSE 8080. Container runs a jboss server with an application deployed on it. Port mappings are :

Command: sudo docker port be1837e849dc

Output: 8080/tcp -> 0.0.0.0:32771

When I try to access the web application running on jboss in the container from the mapped host port using url:

http://IPAddressOfHost:32771/

I get connection refused error. Following is the result of command "netstat -tulpn"

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -               
tcp6       0      0 :::9999                 :::*                    LISTEN      -               
tcp6       0      0 :::22                   :::*                    LISTEN      -               
tcp6       0      0 :::32771                :::*                    LISTEN      -               
udp        0      0 0.0.0.0:68              0.0.0.0:*                           -        

I tried doing telnet hostip 32771 and it also results in connection refused.

Docker version 1.12.1  
build 23cf638

What could be the possible reason for this?

Thanks in advance

Rao
  • 20,781
  • 11
  • 57
  • 77
akki
  • 423
  • 2
  • 12
  • 2
    First thing to check is if your container is actually listening on port 8080. You can get the IP address of your container with `docker inspect`, and try browsing from the host to `http://[container-ip]:8080` – Elton Stoneman Oct 25 '16 at 08:52
  • 1
    What is the result of `sudo docker ps`? – Rao Oct 25 '16 at 10:21

1 Answers1

1

I found that jboss server running inside the container was not listening on 0.0.0.0. One option to do this is, while starting the standalone server use -b 0.0.0.0.

/bin/standalone.sh -b 0.0.0.0

akki
  • 423
  • 2
  • 12