Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wildfly in Docker container not starting

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
like image 858
ps0604 Avatar asked Dec 10 '19 20:12

ps0604


2 Answers

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

like image 102
Ivan Vovk Avatar answered Oct 16 '22 10:10

Ivan Vovk


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

like image 36
Tyhal Avatar answered Oct 16 '22 09:10

Tyhal