Docker запускает Tomcat: время ожидания последнего соединения - PullRequest
0 голосов
/ 30 сентября 2018

Получил «ERR_CONNECTION_TIMED_OUT» при запуске docker для версии Windows:
Docker version 18.06.1-ce, build e68fc7a.
Использование контейнеров Linux (настройки мастера установки по умолчанию).Docker inspect 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

Нет прокси в настройках докера.

enter image description here

Docker Logs containerID:

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

1 Ответ

0 голосов
/ 30 сентября 2018

Ясно, что сопоставление портов не выполнено должным образом:

 "Ports": {
        "8080/tcp": null
  }

null означает, что док-порт внутри порта 8080 не сопоставлен с соответствующим снаружи.

, когда порт несопоставленный, не будет никакого способа получить к нему доступ по URL, и вы получите ERR_CONNECTION_TIMED_OUT

, так как не ясно, как вы запустили свой контейнер, я могу только предложить вам простой и правильный способ портасопоставление будет:

docker run -it --rm -p 8080:8080 tomcat:latest

, где внешний порт 8080 сопоставлен с внутренним портом Docker Tomcat 8080, тогда вы можете получить к нему доступ по localhost: 8080

...