我在端口9090上的docker容器中启动了JBoss,也暴露了它。使用命令获取容器的IP地址:
docker inspect -f' {{.NetworkSettings.IPAddress}}' fdb6c05966bd
现在当我尝试访问浏览器" IP地址":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 logs 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)
答案 0 :(得分:1)
假设您的计算机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 host
docker run -d -p 9090:9090 .... jbossimage
然后,从您的计算机上,您可以使用192.168.33.100:9090