Can't get docker to release ports from old container

I had a container with a couple of ports being used (2468 and 7474) which I deleted to create a new container with a different release, but synology/docker won’t release the ports for me to use with any other containers now. I’ve tried rebooting but that didn’t help

I tried killing the service using the port by running sudo -i netstat -nlp | grep 2468 then kill -9 <pid>.
I ran netstat to verify the ports weren’t there but it still won’t let me create it.

Error response from daemon: driver failed programming external connectivity on endpoint (8e881fe60444fc3e8db4571339d17050424ca3ef568a3209f5da17816a15285f): Bind for 0.0.0.0:2468 failed: port is already allocated

Please share the output of sudo netstate -tlpn so we can see which process actually binds the port.

I do not have that command netstate available on a Synology. But here is sudo netstat -tlpn

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:8686            0.0.0.0:*               LISTEN      1954/docker-proxy
tcp        0      0 0.0.0.0:5454            0.0.0.0:*               LISTEN      32668/docker-proxy
tcp        0      0 0.0.0.0:9999            0.0.0.0:*               LISTEN      6594/docker-proxy
tcp        0      0 0.0.0.0:6767            0.0.0.0:*               LISTEN      3407/docker-proxy
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      5090/nginx: worker
tcp        0      0 0.0.0.0:7475            0.0.0.0:*               LISTEN      985/docker-proxy
tcp        0      0 0.0.0.0:5555            0.0.0.0:*               LISTEN      32693/docker-proxy
tcp        0      0 127.0.0.1:33300         0.0.0.0:*               LISTEN      9652/python3
tcp        0      0 0.0.0.0:4533            0.0.0.0:*               LISTEN      6633/docker-proxy
tcp        0      0 0.0.0.0:3000            0.0.0.0:*               LISTEN      917/docker-proxy
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      13961/postgres
tcp        0      0 0.0.0.0:24              0.0.0.0:*               LISTEN      9417/sshd: /usr/bin
tcp        0      0 127.0.0.1:33304         0.0.0.0:*               LISTEN      9028/synomibactiono
tcp        0      0 0.0.0.0:6969            0.0.0.0:*               LISTEN      7322/docker-proxy
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      5090/nginx: worker
tcp        0      0 0.0.0.0:8989            0.0.0.0:*               LISTEN      3961/docker-proxy
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      11218/smbd
tcp        0      0 0.0.0.0:8191            0.0.0.0:*               LISTEN      7588/docker-proxy
tcp        0      0 0.0.0.0:9696            0.0.0.0:*               LISTEN      2725/docker-proxy
tcp        0      0 0.0.0.0:8096            0.0.0.0:*               LISTEN      32752/docker-proxy
tcp        0      0 127.0.0.1:512           0.0.0.0:*               LISTEN      4859/termd
tcp        0      0 127.0.0.1:161           0.0.0.0:*               LISTEN      10380/snmpd
tcp        0      0 0.0.0.0:2468            0.0.0.0:*               LISTEN      30916/docker-proxy
tcp        0      0 0.0.0.0:7878            0.0.0.0:*               LISTEN      5028/docker-proxy
tcp        0      0 0.0.0.0:5510            0.0.0.0:*               LISTEN      17838/abk-agent-ser
tcp        0      0 0.0.0.0:5000            0.0.0.0:*               LISTEN      5090/nginx: worker
tcp        0      0 0.0.0.0:5001            0.0.0.0:*               LISTEN      5090/nginx: worker
tcp        0      0 0.0.0.0:2283            0.0.0.0:*               LISTEN      3479/docker-proxy
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      11218/smbd
tcp        0      0 0.0.0.0:5357            0.0.0.0:*               LISTEN      5090/nginx: worker
tcp6       0      0 :::8686                 :::*                    LISTEN      1962/docker-proxy
tcp6       0      0 :::5454                 :::*                    LISTEN      32674/docker-proxy
tcp6       0      0 :::9999                 :::*                    LISTEN      6601/docker-proxy
tcp6       0      0 :::6767                 :::*                    LISTEN      3416/docker-proxy
tcp6       0      0 :::80                   :::*                    LISTEN      5090/nginx: worker
tcp6       0      0 :::7475                 :::*                    LISTEN      992/docker-proxy
tcp6       0      0 :::5555                 :::*                    LISTEN      32701/docker-proxy
tcp6       0      0 :::4533                 :::*                    LISTEN      6641/docker-proxy
tcp6       0      0 :::3000                 :::*                    LISTEN      925/docker-proxy
tcp6       0      0 :::24                   :::*                    LISTEN      9417/sshd: /usr/bin
tcp6       0      0 :::6969                 :::*                    LISTEN      7328/docker-proxy
tcp6       0      0 :::443                  :::*                    LISTEN      5090/nginx: worker
tcp6       0      0 :::8989                 :::*                    LISTEN      3972/docker-proxy
tcp6       0      0 :::3261                 :::*                    LISTEN      -
tcp6       0      0 :::445                  :::*                    LISTEN      11218/smbd
tcp6       0      0 :::5566                 :::*                    LISTEN      14002/synobtrfsrepl
tcp6       0      0 :::8191                 :::*                    LISTEN      7593/docker-proxy
tcp6       0      0 :::3263                 :::*                    LISTEN      -
tcp6       0      0 :::9696                 :::*                    LISTEN      2733/docker-proxy
tcp6       0      0 :::8096                 :::*                    LISTEN      32760/docker-proxy
tcp6       0      0 :::3264                 :::*                    LISTEN      -
tcp6       0      0 :::3265                 :::*                    LISTEN      12151/scsi_plugin_s
tcp6       0      0 :::2468                 :::*                    LISTEN      30923/docker-proxy
tcp6       0      0 :::7878                 :::*                    LISTEN      5036/docker-proxy
tcp6       0      0 :::5510                 :::*                    LISTEN      17838/abk-agent-ser
tcp6       0      0 :::5000                 :::*                    LISTEN      5090/nginx: worker
tcp6       0      0 :::5001                 :::*                    LISTEN      5090/nginx: worker
tcp6       0      0 :::2283                 :::*                    LISTEN      3485/docker-proxy
tcp6       0      0 :::139                  :::*                    LISTEN      11218/smbd
tcp6       0      0 :::5357                 :::*                    LISTEN      5090/nginx: worker

You are right, I had a typo in my command, I meant to write netstat -tlpn :smiley:

It is indeed the docker-proxy that binds the ports.

How does the output of sudo docker ps -a | grep 2468 look like?

There is nothing that comes up when I run that command.

This problem might indeed happen on Synology boxes with old buggy kernels. https://bcdonadio.com/2017/when-the-blue-whale-sinks/ was a huge discussion in Synology forums years ago - I am surprised if this still is a thing with more recent kernels. I know that people reported that restarting the nas, or even restarting the Docker package (the predecessor of the Container Manager package) “solved” the issue

Anyhow, the docker version that Synology ships with its Container Manger is not vanila Docker, it is customized, maintained and supported by Synology. Even though Synology claims that Docker is the developer… it is not true for any of the customizations Synology did, to make it work with the modified Syno kernels and libraries, or the extra features that are unique to Synology.

There is nothing we (as this community forum), or Docker Inc. (as the company that maintains and supports vanilla Docker) can do here.