【问题标题】:Deployed WAR in Wildfly docker opens webapp in IP 0.0.0.0在 Wildfly docker 中部署的 WAR 在 IP 0.0.0.0 中打开 webapp
【发布时间】:2019-01-03 04:54:54
【问题描述】:

我有 SO 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 但浏览器中的输出是“未找到”。

【问题讨论】:

    标签: docker windows-10 wildfly war


    【解决方案1】:

    您的端口映射-p 8080:9990 不正确。 WildFly 控制台和部署的应用程序通过不同的端口提供服务。所以你不能像那样强制控制台在标准的 8080 端口上运行。

    查看 jboss/wildfly 图像的 usage instructions

    注意端口映射如何定义为-p 8080:8080 -p 9990:9990。这应该使您能够访问管理控制台和任何已部署的应用程序。

    【讨论】:

    • 我执行了docker run -p 8080:8080 -p 9990:9990 wildfly-occoa,然后我可以连接到localhost:8080/docker。谢谢!
    猜你喜欢
    • 2015-08-07
    • 1970-01-01
    • 1970-01-01
    • 2015-04-02
    • 2021-11-24
    • 2014-11-19
    • 1970-01-01
    • 1970-01-01
    • 2019-02-23
    相关资源
    最近更新 更多