Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker does not release ports after stop and remove all container

Tags:

Docker doesn't release port binding after I stop and remove all of containers in my computer. Do you have any suggestion?

ricky@ricky-ubuntu:~$ sudo docker -v Docker version 1.12.2, build bb80604 ricky@ricky-ubuntu:~$ sudo docker ps -a CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES ricky@ricky-ubuntu:~$ sudo netstat -nlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name tcp        0      0 127.0.0.1:5939          0.0.0.0:*               LISTEN      1464/teamviewerd tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      1487/dnsmasq     tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      3623/cupsd       tcp        0      0 127.0.0.1:8000          0.0.0.0:*               LISTEN      2771/docker-proxy tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      1196/mongod      tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      1325/mysqld      tcp        0      0 0.0.0.0:5900            0.0.0.0:*               LISTEN      3485/vino-server tcp6       0      0 :::9999                 :::*                    LISTEN      2597/docker-proxy tcp6       0      0 :::80                   :::*                    LISTEN      2787/docker-proxy tcp6       0      0 :::8080                 :::*                    LISTEN      2755/docker-proxy tcp6       0      0 :::7091                 :::*                    LISTEN      2763/docker-proxy tcp6       0      0 ::1:631                 :::*                    LISTEN      3623/cupsd       tcp6       0      0 :::443                  :::*                    LISTEN      2779/docker-proxy tcp6       0      0 :::9888                 :::*                    LISTEN      2737/docker-proxy tcp6       0      0 :::9889                 :::*                    LISTEN      2728/docker-proxy tcp6       0      0 :::9090                 :::*                    LISTEN      2745/docker-proxy tcp6       0      0 :::5800                 :::*                    LISTEN      3485/vino-server tcp6       0      0 :::5900                 :::*                    LISTEN      3485/vino-server tcp6       0      0 :::9997                 :::*                    LISTEN      2719/docker-proxy 
like image 562
Ricky Avatar asked Oct 20 '16 16:10

Ricky


People also ask

How do I delete all docker containers at once?

Use the docker container prune command to remove all stopped containers, or refer to the docker system prune command to remove unused containers in addition to other Docker resources, such as (unused) images and networks.

How do I release port in docker?

By default, when you create or run a container using docker create or docker run , it does not publish any of its ports to the outside world. To make a port available to services outside of Docker, or to Docker containers which are not connected to the container's network, use the --publish or -p flag.

Does docker stop remove container?

Removing Docker ContainersDocker containers are not automatically removed when you stop them unless you start the container using the --rm flag.

What happens when you stop docker container?

The docker stop command attempts to stop a running container first by sending a SIGTERM signal to the root process (PID 1) in the container. If the process hasn't exited within the timeout period a SIGKILL signal will be sent.


1 Answers

If "docker-compose down" or stopping and removing containers didnt help, I quit docker, then check if the docker.backend is still running (com.docker.backend.exe for windows). Killing that service frees my ports.

Another approach would be "reset to factory defaults" in settings. But that should be the last used solution till it removes everything you set up in Docker.

like image 125
Dagger87 Avatar answered Sep 28 '22 05:09

Dagger87