I'm trying to access the welcome page of Wildfly running on a Docker container in Windows 10 Pro. This is what I did:
Pulled the image:
docker pull jboss/wildfly
Run Wildfly container (this works fine, in the Wildfly log I can see it started correctly):
docker run -it -p 8080:8080 jboss/wildfly
Find the container ID:
docker ps
Inspect the IP address:
docker inspect -f "{{ .NetworkSettings.IPAddress }}" cac63ed21d78
The IP address is 172.17.0.2
, in a browser I go to http://172.17.0.2:8080/ but the browser hangs and times out. What am I missing?
UPDATE
I also tried with 127.0.0.1:8080
and it's not working either
UPDATE2
Console log:
docker --version
#Docker version 19.03.1, build 74b1e89e8a
docker run hello-world
#Hello from Docker!
docker run --detach --publish 8080:80 --name webserver nginx
#Unable to find image 'nginx:latest' locally
#latest: Pulling from library/nginx
#8ec398bc0356: Pull complete
#465560073b6f: Pull complete
#f473f9fd0a8c: Pull complete
#Digest: sha256:b2d89d0a210398b4d1120b3e3a7672c16a4ba09c2c4a0395f18b9f7999b768f2
#Status: Downloaded newer image for nginx:latest
#c5cdb6de11240b5fe33bc424779721e1b44948797fd6ff389004d0766b71dd17
docker ps
#CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c5cdb6de1124
#nginx "nginx -g 'daemon of" 10 minutes ago Up 10 minutes 0.0.0.0:8080->80/tcp webserver
By default, when you create a container, it does not publish any of its ports to the outside world. Network 172.17.X.X is internal. If you need to bind IP address to host ip run docker container with -p flag, like that:
-p 8080:8080
Map TCP port 8080 in the container to port 8080 on the Docker host
From: https://docs.docker.com/docker-for-windows/networking/
Port forwarding works for localhost; --publish, -p, or -P all work. Ports exposed from Linux are forwarded to the host.
So it should be accessible from http://localhost:8080
If that doesn't work, then try the windows example
docker run -d -p 80:80 --name webserver nginx
Which should be accessible http://localhost:80
https://docs.docker.com/docker-for-windows/index#explore-the-application-and-run-examples
If even that fails try:
docker-machine ip default
And use http://[docker-machine-ip]:80
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With