我正在尝试访问在Windows 10 Pro中的Docker容器上运行的Wildfly的欢迎页面。这是我所做的:
拉出图片:
docker pull jboss/wildfly
运行Wildfly容器(这很好,在Wildfly日志中,我可以看到它已正确启动):
docker run -it -p 8080:8080 jboss/wildfly
查找容器ID:
docker ps
检查IP地址:
docker inspect -f "{{ .NetworkSettings.IPAddress }}" cac63ed21d78
IP地址是172.17.0.2
,在浏览器中,我转到http://172.17.0.2:8080/,但是浏览器挂起并超时。我想念什么?
更新
我也尝试过127.0.0.1:8080
,但也不起作用
更新2
控制台日志:
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
10.0.75.x
不是外部地址,浏览器试图在网络上找到它吗?
docker --version
,2. docker run hello-world
,3. docker run --detach --publish 8080:80 --name webserver nginx
,4 . ,然后尝试打开localhost:8080
localhost:8080
,它超时了。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