docker - 在Wildfly docker中部署的WAR以IP 0.0.0.0打开webapp

标签 docker windows-10 wildfly war

我有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/

相关文章:

java - Jersey客户端BASIC认证的Base64编码异常

python - 如何与其他用户共享我的 Tkinter 应用程序?

ssl - Visual Studio 2019 SSL/TLS 安全通道问题

windows-10 - 如何在Windows 10中将分区完全备份到Microsoft OneDrive?

docker - 同一主机上有多个SymmetricDS实例

mysql - 在 camunda wildfly 中配置 mysql

gradle - Wildfly Swarm部署问题-无法解决工件 'xalan:serializer:2.7.1.jbossorg-2'

build - docker构建发布插件出错

database - 如何检查我使用的DolphinDB版本?

带有 Traefik 的 Docker Swarm Windows Worker 返回网关超时