docker 容器中的错误 运行 JBoss

Error running JBoss in docker container

我在端口 9090 上的 docker 容器中启动了 JBoss,暴露了它 too.Got 使用命令的容器的 IP 地址:

docker inspect -f '{{ .NetworkSettings.IPAddress }}' fdb6c05966bd

现在,当我尝试在浏览器中访问 "IP address":9090 时,出现网络错误 (tcp_error)。需要帮助!!

docker ps 给出:

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                          NAMES
9843132314ff        image1.2              "/bin/sh -c '$JBOSS_H"   4 minutes ago       Up 4 minutes        9090/tcp, 9990/tcp, 9999/tcp   elated_allen

并且 docker 记录 9843132314ff 给出:

=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /tmp/jboss-as-7.1.0.Final

  JAVA: /tmp/java/jdk1.7.0_80/bin/java

  JAVA_OPTS:  -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xms1024m -Xmx2048m -XX:MaxPermSize=1024m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml -Djboss.bind.address=0.0.0.0 -Djboss.bind.address.management=0.0.0.0

=========================================================================

18:05:54,743 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA
18:05:55,143 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA
18:05:55,253 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.0.Final "Thunder" starting
18:05:56,912 INFO  [org.xnio] XNIO Version 3.0.3.GA
18:05:56,928 INFO  [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
18:05:56,955 INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
18:05:56,982 INFO  [org.jboss.remoting] JBoss Remoting version 3.2.2.GA
18:05:57,064 INFO  [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
18:05:57,086 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
18:05:57,200 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
18:05:57,211 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
18:05:57,354 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
18:05:57,371 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
18:05:57,398 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
18:05:57,417 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
18:05:57,478 INFO  [org.jboss.as.security] (MSC service thread 1-2) JBAS013100: Current PicketBox version=4.0.6.final
18:05:57,497 INFO  [org.jboss.as.connector] (MSC service thread 1-3) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.7.Final)
18:05:57,584 INFO  [org.jboss.as.naming] (MSC service thread 1-1) JBAS011802: Starting Naming Service
18:05:57,712 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-1) JBAS015400: Bound mail session [java:jboss/mail/Default]
18:05:57,933 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-3) JBoss Web Services - Stack CXF Server 4.0.1.GA
18:05:58,295 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-2) Starting Coyote HTTP/1.1 on http--0.0.0.0-9090
18:05:58,697 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-3) JBAS015012: Started FileSystemDeploymentService for directory /tmp/jboss-as-7.1.0.Final/standalone/deployments
18:05:58,744 INFO  [org.jboss.as.remoting] (MSC service thread 1-3) JBAS017100: Listening on /0.0.0.0:4447
18:05:58,745 INFO  [org.jboss.as.remoting] (MSC service thread 1-4) JBAS017100: Listening on /172.17.0.2:9999
18:05:58,906 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
18:05:58,983 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 4859ms - Started 134 of 205 services (70 services are passive or on-demand)

假设您的机器 IP 是 10.0.0.100,您的 VM IP 是 192.168.33.100,容器 IP 是 172.17.0.2。现在,当您在 VM 中 运行 时,您只能使用 172.17.0.2。因此,如果您在 VM 内并且 运行

curl http://172.17.0.2:9090

这行得通。这根本无法在您的机器上运行。要从您的机器访问它,您需要将容器端口映射到 docker 主机

docker run -d -p 9090:9090 .... jbossimage

然后您可以从您的计算机使用 192.168.33.100:9090

访问 JBOSS 容器