phpmyadmin / docker

Docker container for phpMyAdmin
https://hub.docker.com/_/phpmyadmin
GNU General Public License v3.0
655 stars 451 forks source link
docker mariadb-server mysql-server phpmyadmin

Official phpMyAdmin Docker image

Note that since phpMyAdmin has been accepted in to the official DockerHub repository, you can use either that or this older phpMyAdmin repository for your Docker installation. This is maintained as a courtesy to users who have not migrated.

Run phpMyAdmin with Alpine, Apache and PHP FPM.

GitHub CI build status badge update.sh build status badge amd64 build status badge arm32v5 build status badge arm32v6 build status badge arm32v7 build status badge arm64v8 build status badge i386 build status badge mips64le build status badge ppc64le build status badge s390x build status badge Docker Pulls Docker Stars

All of the following examples will bring you phpMyAdmin on http://localhost:8080 where you can enjoy your happy MySQL administration.

Credentials

phpMyAdmin connects using your MySQL server credentials. Please check your corresponding database server image for information on the default username and password or how to specify your own custom credentials during installation.

The official MySQL and MariaDB images use the following environment variables to define these:

Supported Docker Hub tags

The following tags are available:

A complete list of tags is available at Docker Hub

Image variants

We provide three variations:

Usage with linked server

First you need to run a MySQL or MariaDB server in Docker, and the phpMyAdmin image needs to be linked to the running database container:

docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 phpmyadmin:latest

Usage with external server

You can specify a MySQL host in the PMA_HOST environment variable. You can also use PMA_PORT to specify the port of the server in case it's not the default one:

docker run --name phpmyadmin -d -e PMA_HOST=dbhost -p 8080:80 phpmyadmin:latest

Usage with arbitrary server

You can use arbitrary servers by adding the environment variable PMA_ARBITRARY=1 to the startup command:

docker run --name phpmyadmin -d -e PMA_ARBITRARY=1 -p 8080:80 phpmyadmin:latest

Usage with docker compose and an arbitrary server

This will run phpMyAdmin with the arbitrary server option - allowing you to specify any MySQL/MariaDB server on the login page.

version: '3.1'

services:
  db:
    image: mariadb:10.11
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: notSecureChangeMe

  phpmyadmin:
    image: phpmyadmin
    restart: always
    ports:
      - 8080:80
    environment:
      - PMA_ARBITRARY=1

Adding Custom Configuration

You can add your own custom config.inc.php settings (such as Configuration Storage setup) by creating a file named config.user.inc.php with the various user defined settings in it, and then linking it into the container using:

-v /some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php

On the docker run line like this:

docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 -v /some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php phpmyadmin:latest

Be sure to have <?php as your first line of the configuration file or the contents will not be detected as PHP code.

Example:

<?php

$cfg['ShowPhpInfo'] = true; // Adds a link to phpinfo() on the home page

See the following links for config file information:

Adding custom configuration in /etc/phpmyadmin/conf.d

you can also consider storing your custom configuration files in the folder /etc/phpmyadmin/conf.d, which is very suitable for managing multiple phpMyAdmin configuration files for different hosts,Then you can create server-1.php, server-2.php, or any file name you want, and store them in the conf.d directory mounted on the host.

On the docker run line like this:

docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 -v /some/local/directory/conf.d:/etc/phpmyadmin/conf.d:ro phpmyadmin:latest

Usage behind a reverse proxy

Set the variable PMA_ABSOLUTE_URI to the fully-qualified path (https://pma.example.net/) where the reverse proxy makes phpMyAdmin available.

Sessions persistence

In order to keep your sessions active between container updates you will need to mount the /sessions folder.

-v /some/local/directory/sessions:/sessions:rw

Environment variables summary

For usage with Docker secrets, appending _FILE to the PMA_PASSWORD environment variable is allowed (it overrides PMA_PASSWORD if it is set):

docker run --name phpmyadmin -d -e PMA_PASSWORD_FILE=/run/secrets/db_password.txt -p 8080:80 phpmyadmin:latest

Variables that can be read from a file using _FILE

Run the E2E tests for this docker image

You can run the E2E test suite on a local test environment. The Requirements are make, docker and the docker compose plugin.

Clone this repository: https://github.com/phpmyadmin/docker.git

And then run this command to start the test suite:

make run-tests

For more detailed documentation see https://docs.phpmyadmin.net/en/latest/setup.html#installing-using-docker

Please report any issues with the Docker container to https://github.com/phpmyadmin/docker/issues

Please report any issues with phpMyAdmin to https://github.com/phpmyadmin/phpmyadmin/issues