user11612258
user11612258

Reputation:

docker-pr proc already listening on port 80? Installed docker with snappy on Ubuntu

I ran this:

docker run -ti -p 80:80 --name esproxy "$tag"

but I get this error:

docker: Error response from daemon: driver failed programming external connectivity on endpoint esproxy (ead1fa4f09b2326cd1ff6aa0e3b8f8bfa5c9d353eb6db4efef6d188b81ea9df7): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use.

So I did:

root@ip-172-xx-29-110:/interos/repos/nginx# lsof -i:80

and I got:

COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
docker-pr 28213 root    4u  IPv6  64253      0t0  TCP *:http (LISTEN)

and so this process looks like:

root     28213  0.0  0.0 116552  2620 ?        Sl   04:34   0:00 /snap/docker/384/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 80 -container-ip 172.17.0.2 -container-port 80

does anybody know what that process is?

Upvotes: 15

Views: 19854

Answers (3)

Hevyweb
Hevyweb

Reputation: 458

I found the solution and reason why this happens. First of all I'd like to say, that I use Windows 11 and there is WSL2 installed. Docker is running on my windows machine as well as on Ubuntu (WSL2). When I run docker-compose up on Ubuntu without starting docker on windows, it uses docker on WSL. Then I forgot it, ran docker desktop on windows and ran the project again. On this time it used docker on Windows, however previous version is still running. So when I run docker-compose down it removes only containers from Windows. And when I ran docker ps there was nothing, but when I ran sudo lsof -i :80 it showed that docker-pr still listening port 80. SOLUTION: restart your host machine, don't run docker desktop. Go to WSL and run docker ps. You should see your "orphaned" containers, so just kill them: docker rm <<<container_id>>> --force

Upvotes: 0

valdeci
valdeci

Reputation: 15265

If after you restart the docker service, the docker-pr service allocates some container port, your container is starting automatically.

To check if you have some container running use:

docker ps

To stop this container, we can use:

docker stop container_name

If you have more than one container, we can use:

docker stop $(docker ps -a -q)

To stop a container from starting automatically, we need to remove it from the auto restart.

To do this use the following command:

docker update --restart=no container_name

After this, you will able to restart your docker service and you will not found any container starting automatically.

Upvotes: 5

cholisky
cholisky

Reputation: 185

I had the same issue.

Stoppping all runing containers and restarting the docker service fixed it for me

service docker restart

and then start your container again

Upvotes: 16

Related Questions