docker compose unable to attach to ports for mysql windows

  database, devops, docker, docker-compose, mysql

I am trying to run docker compose up and I am getting this error:

Error response from daemon: Ports are not available: listen tcp 192.168.1.100:13306: can't bind on the specified endpoint

All my other services besides mysql run fine on their designated ports but for some reason mysql does not.

Here is the yml code for mysql:

  db:
    container_name: mysql57
    image: mysql:5.7
    command: mysqld --max_connections=8192 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_ROOT_PASSWORD: ***
      MYSQL_DATABASE: ***
      MYSQL_USER: *****
      MYSQL_PASSWORD: ****
    ports:
      - '127.0.0.1:13306:3306'
      - '192.168.1.100:13306:3306'
    volumes:
      - './../docker/db/data:/var/lib/mysql'
      - './../docker/db/my.cnf:/etc/mysql/conf.d/my.cnf'
      - './../docker/db/sql:/docker-entrypoint-initdb.d'
    restart: always

Let me know what I am doing wrong!

Source: Docker Questions

LEAVE A COMMENT