0

I'm trying to run two separate mysql containers.

However, I'm able to connect only to the client_mysql container from the host (using the port 20001). The server_mysql container is listening on the port 20002 but it's refusing connection.

What settings do I need to change to be able to connect to both mysql containers at the same time?


My docker-compose-dev.yml:

version: '3'
services:

  client_mysql:
    image: mysql:5.7
    container_name: client_mysql
    ports:
      - 20001:3306
    volumes:
      - ./_data/client_mysql:/var/lib/mysql
    environment:
      - MYSQL_ALLOW_EMPTY_PASSWORD=1
      - MYSQL_DATABASE=client_database

  server_mysql:
    image: mysql:5.7
    container_name: server_mysql
    ports:
      - 20002:3306
    volumes:
      - ./_data/server_mysql:/var/lib/mysql
    environment:
      - MYSQL_ALLOW_EMPTY_PASSWORD=1
      - MYSQL_DATABASE=server_database

Output from lsof -i -P (filtered docker mysql ports):

89:com.docke 93244 petrhejda   24u  IPv6 0xd067260469a7469b      0t0  TCP *:20002 (LISTEN)
90:com.docke 93244 petrhejda   26u  IPv6 0xd067260469a73b1b      0t0  TCP *:20001 (LISTEN)

1 Answer 1

1

Solved:

My firewall was blocking the port 20002.

Of course checking the firewall was the first idea I got after right after posting the question. :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.