在为Windows版本运行docker时获得“ ERR_CONNECTION_TIMED_OUT
”:
Docker version 18.06.1-ce, build e68fc7a.
使用linux容器(默认安装向导设置)。
Docker检查containerID给出:"IPAddress": "172.17.0.2"
,
网络设置:
"NetworkSettings": {
"Bridge": "",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"8080/tcp": null
状态:
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 2918,
"ExitCode": 0,
"Error": "",
使用以下命令连接到docker tomcat:http://172.17.0.2:8080
错误消息:ERR_CONNECTION_TIMED_OUT
泊坞窗设置中没有代理。
Docker Logs容器ID:
30-Sep-2018 19:44:54.540 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.5.34
30-Sep-2018 19:44:54.541 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Sep 4 2018 22:28:22 UTC
30-Sep-2018 19:44:54.541 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.5.34.0
30-Sep-2018 19:44:54.542 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
30-Sep-2018 19:44:54.542 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.9.93-linuxkit-aufs
30-Sep-2018 19:44:54.542 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
30-Sep-2018 19:44:54.542 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-8-openjdk-amd64/jre
30-Sep-2018 19:44:54.542 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_181-8u181-b13-1~deb9u1-b13
30-Sep-2018 19:44:54.543 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
30-Sep-2018 19:44:54.543 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat
30-Sep-2018 19:44:54.543 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat
30-Sep-2018 19:44:54.543 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
30-Sep-2018 19:44:54.543 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
30-Sep-2018 19:44:54.544 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
30-Sep-2018 19:44:54.544 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
30-Sep-2018 19:44:54.544 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
30-Sep-2018 19:44:54.544 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
30-Sep-2018 19:44:54.544 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
30-Sep-2018 19:44:54.545 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
30-Sep-2018 19:44:54.545 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
30-Sep-2018 19:44:54.545 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.17] using APR version [1.5.2].
30-Sep-2018 19:44:54.545 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
30-Sep-2018 19:44:54.546 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
30-Sep-2018 19:44:54.548 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.0f 25 May 2017]
30-Sep-2018 19:44:54.609 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
30-Sep-2018 19:44:54.614 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
30-Sep-2018 19:44:54.618 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
30-Sep-2018 19:44:54.619 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
30-Sep-2018 19:44:54.619 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 320 ms
30-Sep-2018 19:44:54.630 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
30-Sep-2018 19:44:54.631 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.34
30-Sep-2018 19:44:54.652 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/host-manager]
30-Sep-2018 19:44:54.835 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/host-manager] has finished in [182] ms
30-Sep-2018 19:44:54.835 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/ROOT]
30-Sep-2018 19:44:54.843 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/ROOT] has finished in [8] ms
30-Sep-2018 19:44:54.844 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/manager]
30-Sep-2018 19:44:54.854 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/manager] has finished in [10] ms
30-Sep-2018 19:44:54.855 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/docs]
30-Sep-2018 19:44:54.862 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/docs] has finished in [8] ms
30-Sep-2018 19:44:54.862 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/examples]
30-Sep-2018 19:44:54.965 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/examples] has finished in [103] ms
30-Sep-2018 19:44:54.966 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]30-Sep-2018 19:44:54.973 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
30-Sep-2018 19:44:54.974 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 355 ms
答案 0 :(得分:0)
很明显,端口映射未正确完成:
"Ports": {
"8080/tcp": null
}
null
表示端口8080内部的docker尚未映射到外部的相应端口。
未映射端口时,将无法通过url访问该端口,并且您将获得ERR_CONNECTION_TIMED_OUT
由于尚不清楚您如何运行容器,我只能建议您使用一种简单而正确的端口映射方法:
docker run -it --rm -p 8080:8080 tomcat:latest
其中8080外部端口映射到docker tomcat 8080内部端口,那么您可以通过localhost:8080进行访问