why I can't start a docker container ? it reports something about the port being allocated

156 views Asked by At

Terminal screenshot

use lsof to show a port, but every port return same info...

[kfadmin@master fundrisksys]$ lsof -i:136
24223   /usr/bin/bash   /dev/pts/0
24223   /usr/bin/bash   /dev/pts/0
24223   /usr/bin/bash   /dev/pts/0
24223   /usr/bin/bash   /dev/pts/0

[kfadmin@master fundrisksys]$ lsof -i:7895
24223   /usr/bin/bash   /dev/pts/0
24223   /usr/bin/bash   /dev/pts/0
24223   /usr/bin/bash   /dev/pts/0
24223   /usr/bin/bash   /dev/pts/0

I can't use any port, it shows same info: Bind for 0.0.0.0:8001 failed: port is already allocated

I try to kill the pid, but the terminal will be killed

2

There are 2 answers

0
Hytrax On

Did you try to run a docker ps -a? You may have a stopped container that reserved this port.

0
Artem Shestakov On

Use netstat -tulpn or ss -tulpn and look at used ports. Find app and pid that uses this port.