docker: Error response from daemon: driver failed programming external connectivity on endpoint mysql (3d8d89f260c9258467f589d4d7d0c27e33ab72d732d1115d1eb42d708606edc4):
So far, the container is occupied
# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a57959032cc9 mysql:5.7 "docker-entrypoint.s…" About a minute ago Created mysql
# docker rm a57959032cc9
a57959032cc9
Error starting userland proxy: listen tcp4 0.0.0.0:3306: bind: address already in use.
the following is the occupied port number
# netstat -tanlp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 948/sshd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 9217/mysqld
tcp 0 0 172.18.7.111:39412 100.100.45.106:443 TIME_WAIT -
tcp 0 0 172.18.7.111:22 58.100.92.78:9024 ESTABLISHED 6899/sshd: root@pts
See for yourself which is occupied, and then delete it with kill + port number