µµÄ¿¿¡¼­ tomcat 8009 Æ÷Æ®¸¦ ¾î¶»°Ô ¿­¾îÁÙ ¼ö ÀÖÀ»±î¿ä ?

   Á¶È¸ 1449   Ãßõ 0    

도커에 톰켓을 설치한 상태이고, 호스트 아파치와 통신하기 위해 8009 포트를 활성해 했는데 통신이 안됩니다.

호스트 아파치 - 8009 잘됨 - 호스트 톰켓

호스트 아파치 - 8009 안됨 - 도커 톰켓 

호스트 톰켓을 도커 톰켓으로 이관하려는 상황입니다.

8009 포트통신이 안되는데 어떻게 체크해볼 수 있고 어떻게 하면 될까요?


[호스트에서 도커 체크]

# telnet 172.17.0.3 8080
Trying 172.17.0.3...
Connected to 172.17.0.3.
Escape character is '^]'. => 잘됨
^CConnection closed by foreign host.

# telnet 172.17.0.3 8009
Trying 172.17.0.3...
telnet: connect to address 172.17.0.3: Connection refused => 안됨

# docker container ls --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}" -a
CONTAINER ID   NAMES                        PORTS
047998d974de   tomcat85-openjdk11-centos9   8009/tcp, 8080/tcp, 8443/tcp
af87c7594908   your_portainer_name          8000/tcp, 9443/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp


*. 컨테이너에는 분명히 8009, 8080, 8443 이 expose되어 있습니다.


[도커 내부에서 자기 자신 체크]

# vi /usr/local/tomcat/conf/server.xml
    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector protocol="AJP/1.3"
               address="0:0:0:0"
               port="8009"
               redirectPort="8443" secretRequired="false"/>


[root@047998d974de /]# telnet 127.0.0.1 8080
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'. => 잘됨
^CConnection closed by foreign host.


[root@047998d974de /]# telnet 127.0.0.1 8009
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'. => 잘됨
^CConnection closed by foreign host.


[root@047998d974de /]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.3  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:ac:11:00:03  txqueuelen 0  (Ethernet)
        RX packets 16461  bytes 24744337 (23.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10017  bytes 754379 (736.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 36  bytes 6198 (6.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 36  bytes 6198 (6.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@047998d974de /]# getenforce
Disabled => selinux 꺼짐


[root@047998d974de /]# ps -ef | grep firewalld
root         127      56  0 15:54 pts/0    00:00:00 grep --color=auto firewalld => 방화벽 없음


톰켓 문제는 아니고, selinux, 방화벽 모두 아닌데, 도커 설정 어딘가가 문제 같은데...

어떻게 해야 8009번 포트가 호스트<->도커 간에 될까요 ?


ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.
Ä÷¯ 2023-02
È£½ºÆ®¿¡¼­ ¿ì¼± tomcat ³»¸®½Ã°í (¹°·Ð ³»¸®¼Ë°ÚÁö¸¸)
netstat -nlp Çغ¸½Ã°í 8009 ¿­·ÁÀÖ´ÂÁö üũÇϽðí
¹æÈ­º®µµ üũ Çغ¸¼¼¿ä~
±×¸®°í µµÄ¿¿¡¼­ Æ÷Æ®Æ÷¿öµù ÇØÁּ˴ÂÁö üũ
     
¹Î»çÀå 2023-02
È£½ºÆ® tomcat Àº ³»·Á³õÀº »óÅÂÀÔ´Ï´Ù.
-------------------------
(µµÄ¿ ³»ºÎ¿¡¼­)
# netstat -nlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address          Foreign Address        State      PID/Program name   
tcp        0      0 0.0.0.0:8080            0.0.0.0:*              LISTEN      1/java             
tcp        0      0 127.0.0.1:8009          0.0.0.0:*              LISTEN      1/java             
tcp        0      0 127.0.0.1:8005          0.0.0.0:*              LISTEN      1/java             
Active UNIX domain sockets (only servers)
Proto RefCnt Flags      Type      State        I-Node  PID/Program name    Path
Active Bluetooth connections (only servers)
Proto  Destination      Source            State        PSM DCID  SCID      IMTU    OMTU Security
Proto  Destination      Source            State    Channel
-------------------------------------
À§¿¡ ½èµíÀÌ ¹æÈ­º®Àº ½ÇÇàµÇ°í ÀÖÁö ¾Ê½À´Ï´Ù.
Midabo 2023-02
´ç¿¬È÷ -p 8009:8009 ´Â Áּ̰ÚÁö¿ä?

ÀÌ°æ¿ì ¾ÈµÈ´Ù¸é -p ¾Æ¹«´Ù¸¥Æ÷Æ®:8009  ¸¦ Áֽðí,

ÇØ´ç Æ÷Æ®·Î´Â Åë½ÅÀÌ µÇ´ÂÁö È®ÀÎÇØ º¸´Â °ÍÀÌ ÁÁÀ» °Í °°½À´Ï´Ù.
     
¹Î»çÀå 2023-02
(È£½ºÆ®¿¡¼­)
# docker container ls --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}" -a
CONTAINER ID  NAMES                        PORTS
df33e6124676  tomcat85-openjdk11-centos9  0.0.0.0:18009->8009/tcp, :::18009->8009/tcp, 0.0.0.0:18080->8080/tcp, :::18080->8080/tcp, 0.0.0.0:32777->8443/tcp, :::32777->8443/tcp

# telnet 172.17.0.3 18080
Trying 172.17.0.3...
telnet: connect to address 172.17.0.3: Connection refused

¸»¾¸ÇϽŴë·Î 18009->8009 ·Î ÁàºÃ´Âµ¥µµ ¾ÈµÇ³×¿ä...
          
Midabo 2023-02
³Ü À§¿¡ netstat °á°ú¸¦ º¸´Ï±î

0.0.0.0:8009. ¸¦ listen ÇÏÁö ¾Ê¾Æ¼­ ±×·± °Í °°½À´Ï´Ù.
docker µµ Æ÷Æ®Æ÷¿öµùÀÌ ¿¬°áµÇ·Á¸é 0.0.0.0 Æ÷Æ®·Î ¹Þ¾Æ¾ß ¿ÜºÎ listen ÀÌ µÇ´Â °Í °°°í¿ä.  Á¦°¡ ½ÇÁ¦ ¼­ºñ½º ÇÏ´Â µµÄ¿ ³»ºÎÀÇ netstat Âï¾îº¸´Ï±î

Proto Recv-Q Send-Q Local Address          Foreign Address        State      PID/Program name   
tcp        0      0 0.0.0.0:8000            0.0.0.0:*              LISTEN   


ÀÌ·¸°Ô µÇ³×¿ä
               
¹Î»çÀå 2023-02
Proto Recv-Q Send-Q Local Address          Foreign Address        State      PID/Program name 
tcp        0      0 0.0.0.0:8080            0.0.0.0:*              LISTEN      1/java           
tcp        0      0 127.0.0.1:8009          0.0.0.0:*              LISTEN      1/java 

ÀÌ°Í ¸»¾¸À̽DZî¿ä ? 8080°ú 8009°¡ Â÷ÀÌ°¡ ÀÖ±äÇϳ׿ä.
±×·±µ¥ 127.0.0.1 Àº local address ÀÌ°í Foreign address´Â 0.0.0.0* À¸·Î µè´Â´Ù°í µÇ¾î Àִµ¥ À̼³Á¤µµ ¿ÜºÎ¿Í 8009 Åë½ÅÀÌ µÇ¾ß Çϴ°Š¾Æ´Ò±î¿ä ? (Áú¹®)
¹Î»çÀå 2023-02
(È£½ºÆ®)
# netstat -nlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address          Foreign Address        State      PID/Program name
tcp        0      0 0.0.0.0:18080          0.0.0.0:*              LISTEN      94518/docker-proxy
tcp        0      0 0.0.0.0:18009          0.0.0.0:*              LISTEN      94540/docker-proxy
     
Ä÷¯ 2023-02
È£½ºÆ®´Â Á¤»óÀÌ°í
µµÄ¿³»ºÎ 8009 ¼­ºñ½º Çϴ°÷ ¼³Á¤ ÆÄÀÏ¿¡ bind address ÂÊÀ» 0.0.0.0 À» ÇϽøé ÇØ°á µÉ °Í °°½À´Ï´Ù.
          
Midabo 2023-02
°°Àº ÀÇ°ßÀÔ´Ï´Ù!


QnA
Á¦¸ñPage 228/5590
2014-05   4480503   Á¤ÀºÁØ1
2015-12   1032123   ¹é¸Þ°¡
2023-03   1164   ±èȲÁß
2023-03   1270   LevinF
2023-03   1270   °­Çѱ¸
2023-03   1172   VSPress
2023-03   1850   ÀÌâÁØ
2023-03   1051   ZeroTrust
2023-03   1215   Commander
2023-03   1019   ³ª¿ì¸¶Å©
2023-03   1007   keige369
2023-03   2447   ½Ã°ñ³ëÀÎ
2023-03   1027   ¹«½î»Ôó·³
2023-03   1776   ¿ë»õ
2023-03   1021   AplPEC
2023-03   1125   akfalles
2023-03   994   Lucifer
2023-03   1946   ÆÄÇÇǪÆä
2023-03   1801   Àü¼³¼ÓÀǹ̡¦
2023-03   1552   2CPUÃÖÁÖÈñ
2023-03   1503   ±è»èÄá
2023-03   1370   Çã¹Ö¹öµå