docker: Error response from daemon: driver failed programming external connectivity on endpoint mysql (3aeffa115ce7f4e4a8d38e23df7b22c0aac35dc78d864dc046ba6baeeda6b8cf): Error starting userland proxy: listen tcp4 0.0.0.0:3306: bind: address already in use.
时间: 2023-07-17 17:01:16 浏览: 206
The error message indicates that the port 3306, which is the default port for MySQL, is already in use on your system. To resolve this issue, you have a few options:
1. Check for running processes: Run the following command to check if there is any process already using port 3306:
```
sudo lsof -i :3306
```
If the command returns any output, it means that there is a process using that port. You can then decide whether to stop that process or choose a different port for your MySQL container.
2. Use a different port: If you don't want to stop the process using port 3306, you can specify a different host port for your MySQL container. For example, if you want to use port 3307 on the host, you can run the following command:
```
docker run -p 3307:3306 --name=mysql <image_name>
```
This will map port 3307 on the host to port 3306 inside the container.
3. Stop conflicting services: If the process using port 3306 is not necessary and can be stopped, you can stop it using the appropriate commands for your operating system. Once the conflicting process is stopped, you should be able to start your MySQL container on port 3306.
Please note that if you decide to change the port for your MySQL container, you will also need to update the connection settings in any applications or services that interact with it.
阅读全文