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.
How can I configure Docker to end this problem?
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.
Thanks for reply!
This is happening with all my composes.
The OS is Red Hat 7.7 and I installed docker using these commands bellow (with root user):
First I removed older version:
yum remove docker*
yum install docker-ce-20.10.24 docker-ce-cli-20.10.24
So you can’t run any compose project regardless of what port you try to forward?
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:
docker stack deploy -c docker-compose.yml service
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:
yum install docker-compose-plugin
The problem still here, someone can help me please?
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.