系统:Windows 10 专业版 20H2 19042.1415
docker版本:20.10.11, build dea9396


docker-compose.yaml:

version: "3"
services:
  mysql:
    image: "mysql:5.7"
    restart: always
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: "123456"


报错日志:

Creating docker_mysql_1 ... error

ERROR: for docker_mysql_1  Cannot start service mysql: Ports are not available: listen tcp 0.0.0.0:3306: bind: An attempt was made to access a socket in a way forbidden by its access permissions.

ERROR: for mysql  Cannot start service mysql: Ports are not available: listen tcp 0.0.0.0:3306: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
ERROR: Encountered errors while bringing up the project.

端口扫描:

netstat -ano | findstr :3306

如果这里返回占用了端口的应用则不用看下面了,直接“taskkill /f /pid 这个应用的PID”,然后“docker-compose up”你的yaml即可启动。


解决方案:
本次在重启电脑后解决了

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐