I’ve installed Docker 20.10.24 version and when I try to up containers on a docker-compose (using command docker-compose up -d), I receive this error:
Error starting userland proxy: listen tcp [::]:9306: bind: address already in use
I already checked the referred port (using netstat -tln | grep 9306) and it’s free. Futhermore, when I use port parameter (ex.: 0.0.0.0:9306) on docker-compose.yml, containers up.
Once I acidentally kept the same port in one compose file for two containers. If you did the same that explains why you see the port is not used if all containers are stopped when you check it.
If it is not the case, please share mor einfo about your environment. Operating system and how exactly you installed Docker.
If you could share your compose file, or just one that gives you the same error, that could help too.
I didn’t notice this part. That would suggest it is not about two containers in the same compose with the same port, but yout operating system and installation method could help to find out what happened.
Yes, I’d like to set a configuration to Docker listen tcp 0.0.0.0 by default. The error message bringed an empty IP and, with that, I don’t know if Docker is listening to referred address.
Another curious point is that I can up compose as a service if I use:
It is not an empty IP, but an IPv6 way to say iit is listening on all IP addresses. At least on all IPv6 addresses, but sometimes it means IPv6+IPv4 too.
And if you get the same error message whatever port you are trying to use, I’m pretty sure Docker is not listening on any of those ports and ther eis something wrong in your compose file even if you get the error with all compose files. Maybe all of them contains the same mistake.
If everything works with docker stack deploy that could be caused by different things, but one could be that it ignores something that compose doesn’t.
A compose plugin bug could also be the reason, so please share your compose version too and how you installed that…
Ok, I read Docker documentation, because I used v1 binary version of docker-compose before and documentation states that v1 and v2 can coexist, so I maintained v1 binary. To install docker-compose v2 I used:
Sorry, but I don’t have more ideas and since I can’t reproduce it and I don’t use Red Hat either, you will have to wait someone who experienced the issue and solved it or at least have a new idea.