title: How to add phpmyadmin to laravel 8 sail docker-compose.yml
body: <p>I'm trying to add <code>phpmyadmin</code> to <strong>laravel 8</strong> <code>docker-compose.yml</code> file.</p>
  <p>Now, I can access <code>phpmyadmin</code> on &quot;http://localhost:8080&quot; but the user is not got <strong>Cannot log</strong>:</p>
  <pre><code>Cannot log in to the MySQL server
  
  mysqli::real_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known
  
  mysqli::real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known
  </code></pre>
  <p><a href="https://i.stack.imgur.com/Gn2vE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Gn2vE.png" alt="enter image description here" /></a></p>
  <p>My <code>docker-compose.yml</code> file looks like this:</p>
  <pre><code># For more information: https://laravel.com/docs/sail
  version: &quot;3&quot;
  services:
    laravel.test:
      build:
        context: ./vendor/laravel/sail/runtimes/8.0
        dockerfile: Dockerfile
        args:
          WWWGROUP: &quot;${WWWGROUP}&quot;
      image: sail-8.0/app
      ports:
        - &quot;${APP_PORT:-80}:80&quot;
      environment:
        WWWUSER: &quot;${WWWUSER}&quot;
        LARAVEL_SAIL: 1
      volumes:
        - &quot;.:/var/www/html&quot;
      networks:
        - sail
      depends_on:
        - mysql
        # - pgsql
        - redis
        # - selenium
    # selenium:
    #     image: 'selenium/standalone-chrome'
    #     volumes:
    #         - '/dev/shm:/dev/shm'
    #     networks:
    #         - sail
    mysql:
      image: &quot;mysql:8.0&quot;
      ports:
        - &quot;${FORWARD_DB_PORT:-3306}:3306&quot;
      environment:
        MYSQL_ROOT_PASSWORD: &quot;${DB_PASSWORD}&quot;
        MYSQL_DATABASE: &quot;${DB_DATABASE}&quot;
        MYSQL_USER: &quot;${DB_USERNAME}&quot;
        MYSQL_PASSWORD: &quot;${DB_PASSWORD}&quot;
        MYSQL_ALLOW_EMPTY_PASSWORD: &quot;yes&quot;
      volumes:
        - &quot;sailmysql:/var/lib/mysql&quot;
      networks:
        - sail
      healthcheck:
        test: [&quot;CMD&quot;, &quot;mysqladmin&quot;, &quot;ping&quot;]
    #    pgsql:
    #        image: postgres:13
    #        ports:
    #            - '${FORWARD_DB_PORT:-5432}:5432'
    #        environment:
    #            PGPASSWORD: '${DB_PASSWORD:-secret}'
    #            POSTGRES_DB: '${DB_DATABASE}'
    #            POSTGRES_USER: '${DB_USERNAME}'
    #            POSTGRES_PASSWORD: '${DB_PASSWORD:-secret}'
    #        volumes:
    #            - 'sailpostgresql:/var/lib/postgresql/data'
    #        networks:
    #            - sail
    redis:
      image: &quot;redis:alpine&quot;
      ports:
        - &quot;${FORWARD_REDIS_PORT:-6379}:6379&quot;
      volumes:
        - &quot;sailredis:/data&quot;
      networks:
        - sail
      healthcheck:
        test: [&quot;CMD&quot;, &quot;redis-cli&quot;, &quot;ping&quot;]
    # memcached:
    #     image: 'memcached:alpine'
    #     ports:
    #         - '11211:11211'
    #     networks:
    #         - sail
    mailhog:
      image: &quot;mailhog/mailhog:latest&quot;
      ports:
        - &quot;${FORWARD_MAILHOG_PORT:-1025}:1025&quot;
        - &quot;${FORWARD_MAILHOG_DASHBOARD_PORT:-8025}:8025&quot;
      networks:
        - sail
  
    phpmyadmin:
      image: phpmyadmin/phpmyadmin
      links:
        - mysql:mysql
      ports:
        - 8080:80
      environment:
        MYSQL_USERNAME: &quot;${DB_USERNAME}&quot;
        MYSQL_ROOT_PASSWORD: &quot;${DB_PASSWORD}&quot;
        PMA_HOST: mysql
  
  networks:
    sail:
      driver: bridge
  volumes:
    sailmysql:
      driver: local
    #    sailpostgresql:
    #        driver: local
    sailredis:
      driver: local
  
  </code></pre>