0

I am trying to access phpMyAdmin behind nginx-proxy Docker image, hosted on my VPS.

When I try login in phpMyAdmin, I get the error: php_network_getaddresses: getaddrinfo failed: Name or service not known

error messages by phpMyAdmin

The docker-compose file is:

version: "3"

services:
  mysql:
    build:
      context: "./bin/mysql8"
    container_name: 'mysql'
    restart: 'always'
    ports:
      - "3306:3306"
    volumes: 
      - ./data/mysql:/var/lib/mysql
      - ./logs/mysql:/var/log/mysql
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: 'sc-phpmyadmin'
    links:
      - mysql
    environment:
      PMA_HOST: mysql
      PMA_PORT: 3306
      PMA_USER: ${MYSQL_USER}
      PMA_PASSWORD: ${MYSQL_PASSWORD}
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    expose:
      - 80
    environment:
       VIRTUAL_HOST: myadmin.example.com
       LETSENCRYPT_HOST: myadmin.example.com
    volumes: 
      - /sessions

networks:
  default:
    external:
      name: nginx-proxy

The connection is protected with letsencrypt-nginx-proxy-companion (working correctly). I have already read this thread about the error https://github.com/jwilder/nginx-proxy/issues/596 , but there is no working solution.

alessionossa
  • 923
  • 2
  • 15
  • 41

1 Answers1

0

This should not be a proxy issue, since the connection from pma is happening directly at the server level. The proxy never gets to know this. Since You can access the pma container (you can see the login page), your proxy setup seems to be working correctly. Can you reach the mysql container from within the pma container?

Try running docker-compose exec phpmyadmin bash to get a shell running inside of the pma container and the run ping mysql.

You could also try to rename the mysql container to db, since the pma container will try to connect to a db at that host by default.

Last, you could try setting the PMA_ARBITRARY=1 env variable at the pma container which will let you connect to any mysql server from it. There you can then try with either mysql or db or so.

(It could also be that the mysql container was not yet ready and therefore rejected the connection - but that would be a different error message).

kolaente
  • 1,252
  • 9
  • 22