docker守护式安装tomcat(汤姆猫)报错:Error starting userland proxy: listen tcp 0.0.0.0:8888: bind: address alrea

用docker安装tomcat的时候,运行镜像,安装tomcat容器出现报错

[root@localhost ~]# docker run -it -p 8888:8080 tomcat
docker: Error response from daemon: driver failed programming external connectivity on endpoint lucid_dirac (7fdf0f2d37b562df424ef3aab38f52fdeb4da6f080e3e4225d4ad5ed7953a8a6): Error starting userland proxy: listen tcp 0.0.0.0:8888: bind: address already in use.

从报错可得知,是 listen tcp 0.0.0.0:8888时报错
启动netstat -tanlp可查看进程

[root@localhost ~]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
7ad296eeff9d        centos:latest       "/bin/bash"         4 hours ago         Up 4 hours                              pedantic_swirles
[root@localhost ~]# netstat -tanlp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      14332/redis-server
tcp        0      0 0.0.0.0:26379           0.0.0.0:*               LISTEN      13680/redis-sentine
tcp        0      0 127.0.0.1:11211         0.0.0.0:*               LISTEN      6137/memcached
tcp        0      0 127.0.0.1:6380          0.0.0.0:*               LISTEN      3654/redis-server 1
tcp        0      0 127.0.0.1:6381          0.0.0.0:*               LISTEN      3793/redis-server 1
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      6324/nginx: master
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      6114/sshd
tcp        0      0 0.0.0.0:8888            0.0.0.0:*               LISTEN      6566/python
tcp        0      0 0.0.0.0:888             0.0.0.0:*               LISTEN      6324/nginx: master
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      6753/master
tcp        0      0 192.168.2.82:8888       192.168.2.18:50767      ESTABLISHED 7032/python
tcp        0      0 127.0.0.1:6379          127.0.0.1:54100         ESTABLISHED 14332/redis-server
tcp        0      0 127.0.0.1:6381          127.0.0.1:41401         ESTABLISHED 3793/redis-server 1
tcp        0      0 127.0.0.1:6380          127.0.0.1:46580         ESTABLISHED 3654/redis-server 1
tcp        0      0 127.0.0.1:54100         127.0.0.1:6379          ESTABLISHED 13680/redis-sentine
tcp        0      0 192.168.2.82:22         192.168.2.18:50191      ESTABLISHED 6482/sshd: root@pts
tcp        0      0 127.0.0.1:6381          127.0.0.1:36384         ESTABLISHED 3793/redis-server 1
tcp        0      0 192.168.2.82:22         192.168.2.18:50199      ESTABLISHED 6484/sshd: root@not
tcp        0      0 192.168.2.82:22         192.168.2.18:50017      ESTABLISHED 6437/sshd: root@not
tcp        0      0 127.0.0.1:41401         127.0.0.1:6381          ESTABLISHED 3654/redis-server 1
tcp        0      0 127.0.0.1:54098         127.0.0.1:6379          ESTABLISHED 13680/redis-sentine
tcp        0     48 192.168.2.82:22         192.168.2.18:50188      ESTABLISHED 6480/sshd: root@pts
tcp        0      0 127.0.0.1:35712         127.0.0.1:6381          ESTABLISHED 13680/redis-sentine
tcp        0      0 127.0.0.1:46580         127.0.0.1:6380          ESTABLISHED 13680/redis-sentine
tcp        0      0 127.0.0.1:46578         127.0.0.1:6380          ESTABLISHED 13680/redis-sentine
tcp        0      0 127.0.0.1:6379          127.0.0.1:54098         ESTABLISHED 14332/redis-server
tcp        0      0 192.168.2.82:22         192.168.2.18:50207      ESTABLISHED 6510/sshd: root@not
tcp        0      0 127.0.0.1:6381          127.0.0.1:35714         ESTABLISHED 3793/redis-server 1
tcp        0      0 127.0.0.1:6380          127.0.0.1:46578         ESTABLISHED 3654/redis-server 1
tcp        0      0 127.0.0.1:35714         127.0.0.1:6381          ESTABLISHED 13680/redis-sentine
tcp        0      0 127.0.0.1:6381          127.0.0.1:35712         ESTABLISHED 3793/redis-server 1
tcp        0      0 127.0.0.1:36384         127.0.0.1:6381          ESTABLISHED 14332/redis-server
tcp6       0      0 :::3306                 :::*                    LISTEN      6817/mysqld
tcp6       0      0 :::26379                :::*                    LISTEN      13680/redis-sentine
tcp6       0      0 :::22                   :::*                    LISTEN      6114/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      6753/master

可以得知占据0.0.0.0:8888的是一个Python相关进程,pid为6566,干掉它,因为不需要

[root@localhost ~]# sudo kill  6566

再次安装

[root@localhost ~]# docker run -it -p 8888:8080 tomcat

成功

[root@localhost ~]# docker run -it -p 8888:8080 tomcat
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/local/openjdk-8
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
20-Sep-2019 06:55:53.833 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name:   Apache Tomcat/8.5.46
20-Sep-2019 06:55:53.835 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Sep 16 2019 18:16:19 UTC
20-Sep-2019 06:55:53.835 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 8.5.46.0
20-Sep-2019 06:55:53.835 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
20-Sep-2019 06:55:53.836 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            3.10.0-957.el7.x86_64
20-Sep-2019 06:55:53.836 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
20-Sep-2019 06:55:53.836 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/local/openjdk-8/jre
20-Sep-2019 06:55:53.836 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_222-b10
20-Sep-2019 06:55:53.836 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
20-Sep-2019 06:55:53.836 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /usr/local/tomcat
20-Sep-2019 06:55:53.836 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /usr/local/tomcat
20-Sep-2019 06:55:53.836 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
20-Sep-2019 06:55:53.837 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
20-Sep-2019 06:55:53.837 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
20-Sep-2019 06:55:53.837 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
20-Sep-2019 06:55:53.837 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
20-Sep-2019 06:55:53.837 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
20-Sep-2019 06:55:53.837 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
20-Sep-2019 06:55:53.837 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
20-Sep-2019 06:55:53.837 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
20-Sep-2019 06:55:53.838 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.23] using APR version [1.5.2].
20-Sep-2019 06:55:53.838 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
20-Sep-2019 06:55:53.838 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
20-Sep-2019 06:55:53.845 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.0k  28 May 2019]
20-Sep-2019 06:55:53.915 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
20-Sep-2019 06:55:53.925 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
20-Sep-2019 06:55:53.936 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
20-Sep-2019 06:55:53.937 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
20-Sep-2019 06:55:53.938 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 440 ms
20-Sep-2019 06:55:53.961 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
20-Sep-2019 06:55:53.961 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.46
20-Sep-2019 06:55:53.971 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/ROOT]
20-Sep-2019 06:55:54.183 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/ROOT] has finished in [211] ms
20-Sep-2019 06:55:54.183 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/docs]
20-Sep-2019 06:55:54.197 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/docs] has finished in [14] ms
20-Sep-2019 06:55:54.197 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/examples]
20-Sep-2019 06:55:54.382 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/examples] has finished in [185] ms
20-Sep-2019 06:55:54.382 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/host-manager]
20-Sep-2019 06:55:54.401 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/host-manager] has finished in [19] ms
20-Sep-2019 06:55:54.401 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/manager]
20-Sep-2019 06:55:54.416 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/manager] has finished in [15] ms
20-Sep-2019 06:55:54.419 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
20-Sep-2019 06:55:54.435 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
20-Sep-2019 06:55:54.437 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 498 ms
20-Sep-2019 06:56:07.606 INFO [http-nio-8080-exec-1] org.apache.tomcat.util.http.parser.Cookie.logInvalidHeader A cookie header was received [1564553141,1565136498,1565944274; serverType=nginx; force=0; pnull=2; rank=a; sites_path=/www/wwwroot; copyFileName=null; cutFileName=null; vcodesum=9; BatchSelected=null; BatchPaste=2; BT_PANEL_6=19703b6f-cfac-4415-b7b4-1bb37b9aa0f3.vWv-4PT0BQUgsJaLt-WFsmdK_H0; PHPSESSID=5b3ivihhq392t66nejq6e34fq2] that contained an invalid cookie. That cookie will be ignored.
 Note: further occurrences of this error will be logged at DEBUG level.
^C20-Sep-2019 06:58:58.796 INFO [Thread-5] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"]
20-Sep-2019 06:58:58.804 INFO [Thread-5] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]
20-Sep-2019 06:58:58.810 INFO [Thread-5] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
20-Sep-2019 06:58:58.833 INFO [Thread-5] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
20-Sep-2019 06:58:58.834 INFO [Thread-5] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
20-Sep-2019 06:58:58.837 INFO [Thread-5] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8080"]
20-Sep-2019 06:58:58.838 INFO [Thread-5] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]

你可能感兴趣的:(linux,docker)