Release local port to Docker

Asked

Viewed 2,528 times

0

When I give a telnet from inside the container on port 3306 it from the refused Connection message.

When running the command below I have an error saying that the door is in use

 docker run -td --name projeto -p 3306:3306 ambiente-dev-projeto-php56-newimage

error:

Error response from daemon: driver failed programming external connectivity on endpoint eLicitacao (b798a52246aca15563410c8967931be996eda3b4a8dffc3a261a75bda547bae1): Error starting userland proxy: listen tcp 0.0.0.0:3306: bind: address already in use.

stopped the mysql of my machine and I ran the command, it works, however, when going up again mysql, it error

Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.

I tried adding this port to Docker-Compose and had the same problems

  • Are you trying to access a door from your machine inside the Docker? Why?

  • I need to access my machine’s Mysql

  • Ever tried connecting directly to your machine’s local IP? Type 192.168.1.42:3306

  • My configuration in the project is like this, the refused Connection

  • I went out to test, I got into Docker, I can drip door 80, and I can’t get that

  • Already had a read in the error report on systemctl status mysql.service?

Show 1 more comment

1 answer

2

You probably have another service MySql using the door :3306, should close or stop this container first.

I advise installing the Docker Portainerfor better management of images and containers, in this link has a tutorial.

So stop the commotion docker-compose down and will have docker-compose up.

Another option is to execute the commands inside the container:

sudo service mysqld stop  
sudo service apache2 stop

And then run on the host terminal docker-compose up -d ....

Or else, just use another door for your MySql, such as for example the :3307, is the fastest and practical.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.