Papaja12
Papaja12

Reputation: 17

Exception: Network.Socket.bind: resource busy (Address already in use) in docker

I'm working in a docker container and get this error. My computer is windows. I tried "netstat -ano -p tcp" in the terminal and it gave me this:

Active Connections

  Proto  Local Address          Foreign Address        State           PID
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       1072
  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING       4
  TCP    0.0.0.0:808            0.0.0.0:0              LISTENING       4004
  TCP    0.0.0.0:1337           0.0.0.0:0              LISTENING       4256
  TCP    0.0.0.0:5040           0.0.0.0:0              LISTENING       8252
  TCP    0.0.0.0:5432           0.0.0.0:0              LISTENING       5604
  TCP    0.0.0.0:7680           0.0.0.0:0              LISTENING       4888
  TCP    0.0.0.0:49664          0.0.0.0:0              LISTENING       836
  TCP    0.0.0.0:49665          0.0.0.0:0              LISTENING       732
  TCP    0.0.0.0:49666          0.0.0.0:0              LISTENING       1496
  TCP    0.0.0.0:49667          0.0.0.0:0              LISTENING       1732
  TCP    0.0.0.0:49668          0.0.0.0:0              LISTENING       3664
  TCP    0.0.0.0:49671          0.0.0.0:0              LISTENING       804
  TCP    0.0.0.0:54235          0.0.0.0:0              LISTENING       4
  TCP    0.0.0.0:54236          0.0.0.0:0              LISTENING       4
  TCP    127.0.0.1:5939         0.0.0.0:0              LISTENING       4368
  TCP    127.0.0.1:6463         0.0.0.0:0              LISTENING       9644
  TCP    127.0.0.1:22350        0.0.0.0:0              LISTENING       3168
  TCP    127.0.0.1:22350        127.0.0.1:54879        ESTABLISHED     3168
  TCP    127.0.0.1:22352        0.0.0.0:0              LISTENING       3980
  TCP    127.0.0.1:37014        0.0.0.0:0              LISTENING       4368
  TCP    127.0.0.1:37114        0.0.0.0:0              LISTENING       4368
  TCP    127.0.0.1:39529        0.0.0.0:0              LISTENING       11964
  TCP    127.0.0.1:39529        127.0.0.1:51976        ESTABLISHED     11964
  TCP    127.0.0.1:39529        127.0.0.1:53917        ESTABLISHED     11964
  TCP    127.0.0.1:49670        0.0.0.0:0              LISTENING       3964
  TCP    127.0.0.1:49670        127.0.0.1:54881        ESTABLISHED     3964
  TCP    127.0.0.1:51976        127.0.0.1:39529        ESTABLISHED     16732
  TCP    127.0.0.1:53917        127.0.0.1:39529        ESTABLISHED     16732
  TCP    127.0.0.1:54879        127.0.0.1:22350        ESTABLISHED     9752
  TCP    127.0.0.1:54881        127.0.0.1:49670        ESTABLISHED     12808
  TCP    172.31.192.1:139       0.0.0.0:0              LISTENING       4
  TCP    192.168.1.136:139      0.0.0.0:0              LISTENING       4
  TCP    192.168.1.136:51014    162.159.133.234:443    ESTABLISHED     8872
  TCP    192.168.1.136:51016    173.194.222.188:443    ESTABLISHED     12700
  TCP    192.168.1.136:52086    20.54.36.229:443       ESTABLISHED     4240
  TCP    192.168.1.136:53220    20.54.37.64:443        ESTABLISHED     13036
  TCP    192.168.1.136:53223    185.199.108.133:443    ESTABLISHED     12700
  TCP    192.168.1.136:53226    151.101.1.69:443       ESTABLISHED     12700
  TCP    192.168.1.136:53235    54.235.48.238:443      ESTABLISHED     12700
  TCP    192.168.1.136:53281    151.101.84.193:443     ESTABLISHED     12700
  TCP    192.168.1.136:53290    185.199.108.154:443    ESTABLISHED     12700
  TCP    192.168.1.136:53294    140.82.113.26:443      ESTABLISHED     12700
  TCP    192.168.1.136:53297    185.199.108.154:443    ESTABLISHED     12700
  TCP    192.168.1.136:53299    104.121.237.149:80     TIME_WAIT       0
  TCP    192.168.1.136:53301    104.208.16.90:443      TIME_WAIT       0
  TCP    192.168.1.136:53302    162.159.138.232:443    ESTABLISHED     15756
  TCP    192.168.1.136:53496    152.199.19.160:443     ESTABLISHED     16732
  TCP    192.168.1.136:63825    35.186.224.47:443      ESTABLISHED     8872

I have already waited for over 30 minutes, and it doesnt end. No experience with netstat before, I'm doing a lab with a ready container which creates this TCP connection. How do I get rid of this error so I can continue with my lab?

Upvotes: 0

Views: 1435

Answers (1)

LoveLace Midnight
LoveLace Midnight

Reputation: 21

you'd recommend you to check what port you're willing to use in your docker lab(let's say 9090) and check if another container is currently usinging it, you can check that in docker with command:

docker ps
CONTAINER ID   IMAGE            COMMAND                  CREATED       STATUS      PORTS                                            NAMES
285f31988553   rd               "python -u ./request…"   6 days ago    Up 6 days   0.0.0.0:9090->9090/tcp                           demo

if you're not using this container you can stop and kill it. if there is no docker container usiging that port it may be a service. i also recommend you to try using another port to run your image.

Upvotes: 1

Related Questions