phpmyadmin can’t connect to mariadb with docker-compose: Packets out of order

So whats wrong with this docker-compose.yml? It actually looks ok to me.

But when i try to log in to phpmyadmin on http://localhost:8080/index.php
i get errors:

Packets out of order. Expected 0 received 1. Packet size=71
mysqli_real_connect(): MySQL server has gone away
mysqli_real_connect(): Error while reading greeting packet. PID=33
mysqli_real_connect(): (HY000/2006): MySQL server has gone away

version: "3"
services:
  db:
    image: mariadb:10.4
    volumes:
      - test_db_data:/var/lib/mysql
    ports:
      - "3306:3306"
    environment:
      MYSQL_DATABASE: test
      MYSQL_USER: test
      MYSQL_PASSWORD: test
      MYSQL_ROOT_PASSWORD: root
    networks:
        - dbtest

  pma:
    image: phpmyadmin/phpmyadmin
    depends_on:
      - db
    ports:
      - 8080:80
    environment:
      - PMA_HOST=db
    networks:
        - dbtest

volumes:
  test_db_data:
networks:
  dbtest:

Context:

  • Docker version 19.03.3
  • docker-compose version 1.23.2

Source: StackOverflow