Error starting userland proxy: listen tcp4 0.0.0.0:3306: bind: address already in use

Catalog

  • 1. The problem is shown in
  • 2. Principle of analysis
  • 3. resolvent

1. The problem is shown in

The following problems occurred

[base] [email protected]:~$ sudo docker start 4438 Error response from daemon: driver failed programming external connectivity on endpoint mysql [d8e2492b2eaef4bfe5e4a64bad7c8cb27d8fb4cc03afb1fd4b85183769e498ae]: Error starting userland proxy: listen tcp4 0.0.0.0:3306: bind: address already in use Error: failed to start containers: 4438

The code screenshot is as follows :

2. Principle of analysis

Reasons for the first half , The main reason can be seen in this part of my article :
docker appear Error response from daemon: driver failed programming external connectivity on endpoint resolvent

For the reason of the second half :Error starting userland proxy: listen tcp4 0.0.0.0:3306: bind: address already in use
The main principles are 3306 The port is occupied , So we need to kill 3306 Port of pid The process number can be or closed mysql The service can be

3. resolvent

It needs to be executed in order :

  • perform systemctl restart docker, About why this , But look at my complete analysis above
  • Restart the following docker Containers systemctl restart docker
  • Check the occupation of port number pid Process number ps -ef|grep 3306

Execution steps :

[base] [email protected]:~$ ps -ef|grep 3306 gaokaoli 957833 859945 0 21:17 pts/0 00:00:00 grep --color=auto 3306

Code screenshot :

Execute the above command again , Found that the pid The process number will change , So it can't be used kill -9 pid Process number , If it is found that the process number will not change , Then you can execute kill command

  • If pid Process number change , Then execute the following command service mysql stop
[base] [email protected]:~$ service mysql stop ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units === stop it “mysql.service” Requires authentication . Authenticating as: kkjz,,, [kkjz] Password: ==== AUTHENTICATION COMPLETE ===

This command just closes mysql, however 3306 The port number of is not closed As shown in the figure :( And its process number keeps changing , unable kill)

  • Then you can start docker Container , If there is already a container , directly start, If not, then run Next
[base] [email protected]:~$ sudo docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4438b7f37917 mysql:5.7 "docker-entrypoint.s…" 2 hours ago Exited [128] 22 minutes ago mysql de4e3ddc6f6c rabbitmq "docker-entrypoint.s…" 3 months ago Exited [0] 6 weeks ago rabbit [base] [email protected]:~$ sudo docker start 4438 4438 [base] [email protected]:~$ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4438b7f37917 mysql:5.7 "docker-entrypoint.s…" 2 hours ago Up 8 seconds 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql [base] [email protected]:~$ ps -ef|grep 3306 root 958022 957542 0 21:18 ? 00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 3306 -container-ip 172.17.0.2 -container-port 3306 root 958028 957542 0 21:18 ? 00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 3306 -container-ip 172.17.0.2 -container-port 3306 gaokaoli 958187 859945 0 21:19 pts/0 00:00:00 grep --color=auto 3306

The screenshot is as follows :

So far, the problem has been solved
If it still doesn't work , Just leave a comment at the bottom of the comment area

How can I start docker on Ubuntu 20.04, if it complains that address is already in use? I tried

docker-compose up -d Starting relaatiotietokannat_db_1 ... Starting relaatiotietokannat_db_1 ... error ERROR: for relaatiotietokannat_db_1 Cannot start service db: driver failed programming external connectivity on endpoint relaatiotietokannat_db_1 [02444b3d0c2841a4fe702cf2705fbd5a869e44e7f258ecfbcea764ead989fcb4]: Error starting userland proxy: listen tcp 0.0.0.0:3306: bind: address already in use ERROR: for db Cannot start service db: driver failed programming external connectivity on endpoint relaatiotietokannat_db_1 [02444b3d0c2841a4fe702cf2705fbd5a869e44e7f258ecfbcea764ead989fcb4]: Error starting userland proxy: listen tcp 0.0.0.0:3306: bind: address already in use ERROR: Encountered errors while bringing up the project.

ERROR: for caddy Cannot start service caddy: driver failed programming external connectivity on endpoint tutor_local_caddy_1 [a78a533576c3b1078f50333e6f5dc1eb9b25090c25296504eb703fe77d92126c]: Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use
ERROR: Encountered errors while bringing up the project.

Hi @johansantri! When asking for support, please do the following:

  1. Mention which tutor version you are running [tutor --version]
  2. Describe the command that you are running [I’m guessing tutor local quickstart, right?]
  3. Please copy-paste the error log instead of posting screenshots. This makes it easier for other people with the same issue to find a solution.

Your problem is almost certainly related to this one: Troubleshooting — Tutor documentation

Basically, you already have a service running on port 80, so Caddy cannot start. You must figure out what is this service and stop it. In most cases, it’s either Apache or Nginx:

sudo netstat -nlptu | grep 80 sudo systemctl stop nginx sudo systemctl stop apache

1 Like

In my case it was another docker instance running on port 80 so if you see docker-proxy when running the first command suggested by @regis then you should probably look for the service listening to this port already in docker ps.

@yaron can you tell me exactly how to stop services?

when i run netstat i get below

root@aydxbopenedx:/home/tabrezg# sudo netstat -nlptu | grep 80 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 45437/docker-proxy

but i cant run stop

root@aydxbopenedx:/home/tabrezg# systemctl stop nginx Failed to stop nginx.service: Unit nginx.service not loaded.

below is the container which is running nginx service

a00c1a02c22a nginx:1.19.9 "/docker-entrypoint.…" 6 minutes ago Up 6 minutes 80/tcp tutor_local_nginx_1

Hey @tabrezgoilkar
Well, in your case, stopping the nginx service requires stopping the relevant container manually [using the docker command].

I assume the service listening to port 80 is dockerized so you’ll need to stop that container and then try restarting tutor.

If you’re unsure and you can send me the full list from docker ps I’ll be able to assist you with stopping the container.

[BTW try to style it as a code, it will be more readable, thanks!]

I’m having the same error!

I’ve used ss command to see which process was listening :80 port: it’s a process called docker-proxy

What do you think i can do?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Video liên quan

Chủ Đề