Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

465
Vistas
phpmyadmin in docker-compose

I dockerized a Laravel project and I want to run PhpMyAdmin while running beside MySQL.

My problem is I can't login PhpMyAdmin in PhpMyAdmin page.

Here is the error: mysqli::real_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known.

This is the content of my docker-compose.yml file:

version: '3'
networks:
  laravel:

services:
  mysql:
    image: mysql:5.7.22
    container_name: mysql
    tty: true
    restart: unless-stopped
    ports:
      - "4506:3306"
    volumes:
      - ./mysql:/var/lib/mysql
    environment:
      MYSQL_DATABASE: homestead
      MYSQL_USER: homestead
      MYSQL_PASSWORD: secret
      MYSQL_ROOT_PASSWORD: secret
      MYSQL_TAGS: dev
      SERVICE_NAME: mysql
    networks:
      - laravel
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    depends_on:
      - mysql
    ports:
      - 8181:80
    environment:
      MYSQL_USERNAME: homestead
      MYSQL_ROOT_PASSWORD: secret
    networks:
      - laravel

What am I missing?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You need to specify the PMA_HOST environment variable to tell phpmyadmin where to find the mysql server (in this case, the hostname is simply the service name, mysql):

version: '3'
networks:
  laravel:

services:
  mysql:
    image: mysql:5.7.22
    container_name: mysql
    tty: true
    restart: unless-stopped
    ports:
      - "4506:3306"
    volumes:
      - ./mysql:/var/lib/mysql
    environment:
      MYSQL_DATABASE: homestead
      MYSQL_USER: homestead
      MYSQL_PASSWORD: secret
      MYSQL_ROOT_PASSWORD: secret
      MYSQL_TAGS: dev
      SERVICE_NAME: mysql
    networks:
      - laravel
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    depends_on:
      - mysql
    ports:
      - 8181:80
    environment:
      PMA_HOST: mysql
      MYSQL_USERNAME: homestead
      MYSQL_ROOT_PASSWORD: secret
    networks:
      - laravel
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda