phpmyadmin / docker

Docker container for phpMyAdmin
https://hub.docker.com/_/phpmyadmin
GNU General Public License v3.0
675 stars 455 forks source link

Connection to container fails. #359

Closed pixeline closed 2 years ago

pixeline commented 2 years ago

I have a (huge) legacy php5.3 application to maintain.

i'm using this PHP 5.3 with MySQL 5.1 docker image to work on an old (huge) codebase I recently received. I would like to add phpMyAdmin to be able to tweak the database structure as I go. I added it to the docker-compose.yml file, as such:

version: '2.1'
services:
  app:
    image: banesto/docker-php5.3-dev
    container_name: web
    volumes:
      - ./php5-public:/var/www/html
      - ./.database:/var/lib/mysql
      - ./sql:/sql
      - ./logs:/etc/httpd/logs
    ports:
      - "1973:80"
      - "33066:3306"
    stdin_open: true
    environment:
      DB_NAME: dbname
      DB_USER: test
      DB_PASS: test
      MYSQL_ROOT_PASSWORD: my_secret_password
      MYSQL_DATABASE: dbname
      MYSQL_USER: test
      MYSQL_PASSWORD: test

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:4
    container_name: pma
    links:
      - app
    depends_on:
      - app
    environment:
      PMA_HOST: web
      PMA_PORT: 3306
      PMA_ARBITRARY: 0
    restart: always
    ports:
      - 1974:80

When I visit localhost:1974, I see the phpmyadmin login screen. I then login successfully but as soon as i land on the PMA dashboard I get this error message:

Error in processing request Error code: 200 Error text: OK (rejected) It seems that the connection to server has been lost. Please check your network connectivity and server status.

And i'm back at the login screen. I tried with latest phpmyadmin as well, same error and behaviour. Would you have an idea on how to make it work?

ibennetch commented 2 years ago

Are there any hints in the webserver error log (which you can probably see by starting docker-compose without putting it in the background, that is without the -d flag, or with docker-compose logs)? An error 200 usually means something went wrong that should be logged further so hopefully that gives you some hint.

pixeline commented 2 years ago

It turns out it was an incompatibility issue between phpmyadmin's latest 4 version and mysql version 5.1. Forcing an earlier PMA version solved the issue. Here is the working docker-compose:

version: '2.1'
services:
  app:
    image: banesto/docker-php5.3-dev
    container_name: web
    volumes:
      - ./php5-public:/var/www/html
      - ./.database:/var/lib/mysql
      - ./sql:/sql
      - ./logs:/etc/httpd/logs
    ports:
      - "1973:80"
      - "33066:3306"
    stdin_open: true
    restart: always
    environment:
      DB_NAME: test
      DB_USER: test
      DB_PASS: test
      MYSQL_ROOT_PASSWORD: my_secret_password
      MYSQL_DATABASE: test
      MYSQL_USER: test
      MYSQL_PASSWORD: test

  pma:
    image: dnhsoft/phpmyadmin:4.0.0
    links:
      - app
    ports:
      - "1974:80"
    environment:
      DBHOST: web
      DBUSER: test
      DBPASS: test