我有Windows 10 Pro,这是我的docker文件:
FROM jboss/wildfly
ADD docker.war /opt/jboss/wildfly/standalone/deployments/
RUN /opt/jboss/wildfly/bin/add-user.sh admin Admin#70365 --silent
EXPOSE 9990
CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"]
然后,使用以下命令构建镜像:
docker build --tag=wildfly-occoa .
下一步是执行以下行:
docker run -p 8080:9990 wildfly-occoa
控制台的最后几行是:
03:36:19,761 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 75) WFLYUT0021: Registered web context: '/docker' for server 'default-server'
03:36:19,773 INFO [org.jboss.as.server] (ServerService Thread Pool -- 43) WFLYSRV0010: Deployed "docker.war" (runtime-name : "docker.war")
03:36:19,852 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
03:36:19,856 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://0.0.0.0:9990/management
03:36:19,859 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://0.0.0.0:9990
03:36:19,859 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 15.0.0.Final (WildFly Core 7.0.0.Final) started in 10470ms - Started 409 of 594 services (326 services are lazy, passive or on-demand)
Wildfly控制台在URL http://localhost:8080/console/index.html中打开没有问题,但是当我尝试打开已部署的WAR时,它将在0.0.0.0:8080/docker中打开webapp
Capture of wildfly web console
Capture of war in browser
我尝试使用localhost:8080 / docker和127.0.0.1:8080/docker,但浏览器中的输出为“未找到”。
最佳答案
您的端口映射-p 8080:9990
不正确。 WildFly控制台和已部署的应用程序通过不同的端口提供。因此,您不能像这样强制控制台在标准8080端口上运行。
看一下jboss / wildfly图像的usage instructions。
注意如何将端口映射定义为-p 8080:8080 -p 9990:9990
。这应该使您能够访问管理控制台和任何已部署的应用程序。
关于docker - 在Wildfly docker中部署的WAR以IP 0.0.0.0打开webapp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54016548/