Docker ports confussion

Required Information

  • DietPi version | G_DIETPI_VERSION_CORE=8
  • Distro version | bookworm 0
  • Kernel version | Linux DietPi 6.1.21-v8+ #1642 SMP PREEMPT
  • Architecture | arm64
  • SBC model | RPi 4 Model B (aarch64)
  • SD card used | SanDisk

He there!

I hope you are having a joyful Christmas time and a happy new year.

I have an issue with some docker containers. I rebooted my rpi and after that, some of the containers got under “exited”, when I tried to restart them again an error message appeared saying that it wasn’t possible to redeploy the containers because the ports were used. If I change the ports of the container they run again but I want to have the default ports. It is easier for me to keep things under control.

I’ll appreciate your help.

Thanks in advance.

you can check available and used ports as follow

ss -tulpn | grep LISTEN

Which ports are in question?

Thank you for your help.

I’ve found a concurrency:

tcp   LISTEN 0      4096               *                                                                                                                                                                 users:(("docker-proxy",pid=23226,fd=4))
tcp   LISTEN 0      4096               *                                                                                                                                                                 users:(("docker-proxy",pid=6872,fd=4))

I erased the container using the port 9091 and redeployed it again using the port 9093. IDK why the port 9091 is being used. Any hint?

well, it’s your configuration and your container. So nope I don’t know. :wink:

I mean if I erased the container, why does the port appear as used?, what should I do to free it?

Apparently the previous instance is still running.

Thank you for your help.

I think so too. But I don’t know how to stop it.

Usually the docker rm -f container_name does the trick. What is the output of docker ps ?

check running container

docker ps -a

And you can have a look to Docker docs Use the Docker command line | Docker Docs

The thing is that there isn’t a container using the port 9091.

2540890545be "/init" 33 hours ago Up 33 hours>9091/tcp,>51413/tcp,>51413/udp transmission

What about the process: ps -ef | grep 6872

root        6872    6405  0 Jan01 ?        00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip -host-port 9091 -container-ip -container-port 9091
root      984887  968303  0 12:39 pts/0    00:00:00 grep 6872

(I don’t understand what it means)

looks like a zombie proses. did you already reboot your system? Does it still show the container blocking port 9091

1 Like

I rebooted the system, it didn’t work. I rebooted again, and the same. I shut it down and now everything is back to normal.

Thank you both for your patience and help.

1 Like

this seems to be strange if a soft reboot is not working and the process is still there but a full power off worked? :thinking: Could it be that the soft reboot did not work correctly?

Yep. It is strange. Normally, when I face a problem the first thing I do is to reboot the system. Then I try to recreate everything. Since it didn’t work that’s why I asked for help.

Thanks again.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.