Open BSthun opened 3 years ago
hey @BSthun do you see the same issue with Docker CE 20.10.2
Wow, the issue have resolved in Docker CE 20.10.2. Thank you so much.
Hello again. From that issue, I found another issue that I think it's related to. On Docker CE 20.10.2
, yes it released the port, but it's also doesn't bind the host port at all.
From the same compose file as above (https://github.com/docker/for-linux/issues/1180#issue-778577235), I after I run docker-compose up
, the container created, but unfortunately that it's doesn't bind the host port even set the compose file to expose that port. In docker ps
, it's show only the exposed port of the container without binding to external IP or 0.0.0.0. Like this:
And the same, I use the same config to run on Docker CE 19.03.14
, with same host and environment (fresh reinstall debian 10) it works fine. I'm not sure this is issue of Docker CE or Docker Compose. but changing version of Docker works for me.
Same problem at Docker version 20.10.9, build c2ea9bc90b
Same problem at Docker version 20.10.8, build 3967b7d
with kenel 5.11.0-40-generic
on Ubuntu 20.04.3 LTS
.
Same problem with Docker version 20.10.13, build a224086
on MacOS Monterey with M1
Same problem version 20.10.13 on Windows, WSL2
It seems to me I'm having the same issue on Docker Desktop for Windows.
The issue have resolved in Docker CE 20.10.2. Could you backport it to any 19.x version please? Thank you.
Im faceing the same issue on my mac m2 pro When i first run the docker-compose up the container works fine but when it stops i get that the port is already in use : Docker version :24.0.7 Error :
de:net:1876
cmdb-integration-1 | const error = new UVExceptionWithHostPort(rval, 'listen', address, port);
cmdb-integration-1 | ^
cmdb-integration-1 |
cmdb-integration-1 | Error: listen EADDRINUSE: address already in use /tmp/tsx-0/33.pipe
cmdb-integration-1 | at Server.setupListenHandle [as _listen2] (node:net:1876:21)
cmdb-integration-1 | at listenInCluster (node:net:1941:12)
cmdb-integration-1 | at Server.listen (node:net:2046:5)
cmdb-integration-1 | at file:///cmdb-integration/node_modules/tsx/dist/cli.mjs:53:31317
cmdb-integration-1 | at new Promise (<anonymous>)
cmdb-integration-1 | at yn (file:///cmdb-integration/node_modules/tsx/dist/cli.mjs:53:31295)
cmdb-integration-1 | at async file:///cmdb-integration/node_modules/tsx/dist/cli.mjs:53:32265 {
cmdb-integration-1 | code: 'EADDRINUSE',
cmdb-integration-1 | errno: -98,
cmdb-integration-1 | syscall: 'listen',
cmdb-integration-1 | address: '/tmp/tsx-0/33.pipe',
cmdb-integration-1 | port: -1
cmdb-integration-1 | }
Seems like you're binding to unix socket. Could you try remove the container (docker compose down) and start it again?
yep i did that and still have the same issue(it runs the first time when i do compose up again but not the second time )
I'm encountering this issue as well. The container works fine the first time running docker compose up, but if I stop the container then run compose up again, it errors with Error: listen EADDRINUSE: address already in use
. If I destroy the containers with docker compose down and then run compose up, the new containers work fine. But it would be nice to reuse the same containers instead of having to destroy/create new ones each time.
Machine: Mac M1 Pro, macOS Monterey
Docker version: 23.0.0, build e92dd87c32
I ran into the same Problem. I am using Ubuntu 22.04.4. I have multiple machines but only the one running Docker version 27.0.1, build 7fafd33 seems to have this problem. The machines with Docker version 26.x.x are all running as excepted.
@ZantaShock Could you please try to:
docker-proxy
processes that aren't cleaned up ;docker inspect
of that container, and then stop it and restart it again to reproduce the issue ;docker inspect
output and all the logs generated by the daemon during the previous step.Also, could you check that the port is really bound with ss -lpn | grep <YOURPORT>
.
@akerouanton Killing docker-proxy processes worked. It the only workaround I had. I managed to resolve the problem by upgrading docker to the newest version.
If you (or anyone else) ever run into this again, please try to reproduce the issue and send us everything mentioned in this comment: https://github.com/docker/for-linux/issues/1180#issuecomment-2301323708. Otherwise we won't be able to solve it.
@ZantaShock Could you please try to:
* Stop any running container and kill `docker-proxy` processes that aren't cleaned up ; * Then, enable debug logs (see here: https://docs.docker.com/engine/daemon/logs/#enable-debugging) ; * Start your container, do a `docker inspect` of that container, and then stop it and restart it again to reproduce the issue ; * Paste here both the `docker inspect` output and all the logs generated by the daemon during the previous step.
Also, could you check that the port is really bound with
ss -lpn | grep <YOURPORT>
.
I encountered this Issue again after the Ubuntu-Server crashed. The problem disappered after killing the docker-proxy. Using docker stop seems to clean up correctly. Also the port is really bound even after a restart of the Server.
I think I found the Issue. I noticed a stranger behavior hinting that multiple instances of a application where running on the same server. After stopping the only visible container and the application was still available I found this thread:
https://forums.docker.com/t/docker-ps-a-doesnt-show-running-containers/121046/5
Docker was in fact installed with snap and apt.
@akerouanton I stopped all containers and then I see in the processes
/usr/bin/rootlesskit-docker-proxy -proto tcp -host-ip 10.1.1.222 -host-port 80 -container-ip 172.23.0.3 -container-port 80
So I killed that. Then I ran docker compose caddy
for
services:
caddy:
image: caddy:alpine
depends_on:
- gitlab
restart: unless-stopped
ports:
- "${GITLAB_HOST}:80:80"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
...
resulting in
[+] Running 2/0
✔ Container gitlab-gitlab-1 Running 0.0s
✔ Container gitlab-caddy-1 Created 0.0s
Attaching to caddy-1
Gracefully stopping... (press Ctrl+C again to force)
Error response from daemon: driver failed programming external connectivity on endpoint gitlab-caddy-1 (effe7a42689db5235beb8036c1d2c42bd0322ec5cad04fbffa1efcc386b44e40): failed to bind port 10.1.1.222:80/tcp: Error starting userland proxy: error while calling PortManager.AddPort(): conflict with ID 6
and lo and behold rootlesskit-docker-proxy is back listening on port 10.1.1.222:80
I setup the daemon on this machine to run in rootless mode, and I also apply this capability https://docs.docker.com/engine/security/rootless/#exposing-privileged-ports
I can confirm via sudo setcap -v cap_net_bind_service=ep $(which rootlesskit)
that it has the capability
/usr/bin/rootlesskit: OK
Docker version 27.2.0, build 3ab4256 rootlesskit version 2.0.2 Ubuntu 24.04
Should I make another issue? My container doesn't even start
Expected behavior
After stopped the container that binded the host port. The binded port should be released and any containers (including itself) are able to bind that port afterward.
Actual behavior
I started a container that bind (expose) the port on host. At first time when started the container, it's able to start successfully, but after I've stopped that container (or even stopped and run
docker system prune -a
) and run it again, it's says0.0.0.0:443: bind: address already in use
and2607:f130:0:f8::4290:6146:443 failed: port is already allocated
which means binded port since first time of starting container hasn't been release yet.Workaround
systemctl restart docker
)5:19.03.14~3-0~debian-buster
)Steps to reproduce the behavior
I'm running Docker on Debian 10 buster (fresh install) using
docker-ce (5:20.10.1~3-0~debian-buster)
,docker-ce-cli (5:20.10.1~3-0~debian-buster)
with Docker Compose.My Docker Compose file
First time I started the container using, it's works correctly. After I've stop them and bring it up again (with no any modification to docker and docker compose file), it says
By these same steps, but with Docker
5:19.03.14~3-0~debian-buster
, it's works correctly with no any issue.Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.)