Home

Awesome

osixia/phpmyadmin

Docker Pulls Docker Stars

Latest release: 5.0.2 - phpMyAdmin 5.0.2 - Changelog | Docker Hub 

A docker image to run phpMyAdmin.

phpmyadmin.net

Quick start

Run a phpMyAdmin docker image by replacing db.example.com with your mysql host or IP :

docker run -p 6443:443 \
       --env PHPMYADMIN_DB_HOSTS=db.example.com \
       --detach osixia/phpmyadmin:5.0.2

That's it :) you can access phpMyAdmin on https://localhost:6443

MariaDB & phpMyAdmin in 1'

Example script:

	#!/bin/bash -e
	docker run --name bdd-service --hostname bdd-service --env MARIADB_ROOT_ALLOWED_NETWORKS="#PYTHON2BASH:['172.17.%.%', 'localhost', '127.0.0.1', '::1']" --detach osixia/mariadb:0.2.9

	docker run --name phpmyadmin-service --hostname phpmyadmin-service --link bdd-service:bdd-host --env PHPMYADMIN_DB_HOSTS=bdd-host --detach osixia/phpmyadmin:5.0.2

	PHPMY_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" phpmyadmin-service)

	echo "Go to: https://$PHPMY_IP"
	echo "Login: admin"
	echo "Password: admin"

Beginner Guide

Use your own phpMyAdmin config

This image comes with a phpMyAdmin config.inc.php file that can be easily customized via environment variables for a quick bootstrap, but setting your own config.inc.php is possible. 2 options:

HTTPS

Use autogenerated certificate

By default HTTPS is enable, a certificate is created with the container hostname (it can be set by docker run --hostname option eg: phpmyadmin.my-company.com).

docker run --hostname phpmyadmin.my-company.com --detach osixia/phpmyadmin:5.0.2

Use your own certificate

You can set your custom certificate at run time, by mounting a directory containing those files to /container/service/phpmyadmin/assets/apache2/certs and adjust their name with the following environment variables:

docker run --volume /path/to/certifates:/container/service/phpmyadmin/assets/apache2/certs \
--env PHPMYADMIN_HTTPS_CRT_FILENAME=my-cert.crt \
--env PHPMYADMIN_HTTPS_KEY_FILENAME=my-cert.key \
--env PHPMYADMIN_HTTPS_CA_CRT_FILENAME=the-ca.crt \
--detach osixia/phpmyadmin:5.0.2

Other solutions are available please refer to the Advanced User Guide

Disable HTTPS

Add --env PHPMYADMIN_HTTPS=false to the run command :

docker run --env PHPMYADMIN_HTTPS=false --detach osixia/phpmyadmin:5.0.2

Fix docker mounted file problems

You may have some problems with mounted files on some systems. The startup script try to make some file adjustment and fix files owner and permissions, this can result in multiple errors. See Docker documentation.

To fix that run the container with --copy-service argument :

	docker run [your options] osixia/phpmyadmin:5.0.2 --copy-service

Debug

The container default log level is info. Available levels are: none, error, warning, info, debug and trace.

Example command to run the container in debug mode:

docker run --detach osixia/phpmyadmin:5.0.2 --loglevel debug

See all command line options:

docker run osixia/phpmyadmin:5.0.2 --help

Environment Variables

Environment variables defaults are set in image/environment/default.yaml

See how to set your own environment variables

Apache :

HTTPS :

Reverse proxy HTTPS :

Other environment variables:

Set your own environment variables

Use command line argument

Environment variables can be set by adding the --env argument in the command line, for example:

docker run --env PHPMYADMIN_DB_HOSTS="db.example.org" \
--detach osixia/phpmyadmin:5.0.2

Link environment file

For example if your environment file is in : /data/environment/my-env.yaml

docker run --volume /data/environment/my-env.yaml:/container/environment/01-custom/env.yaml \
--detach osixia/phpmyadmin:5.0.2

Take care to link your environment file to /container/environment/XX-somedir (with XX < 99 so they will be processed before default environment files) and not directly to /container/environment because this directory contains predefined baseimage environment files to fix container environment (INITRD, LANG, LANGUAGE and LC_CTYPE).

Make your own image or extend this image

This is the best solution if you have a private registry. Please refer to the Advanced User Guide just below.

Advanced User Guide

Extend osixia/phpmyadmin:5.0.2 image

If you need to add your custom TLS certificate, bootstrap config or environment files the easiest way is to extends this image.

Dockerfile example:

FROM osixia/phpmyadmin:5.0.2
MAINTAINER Your Name <your@name.com>

ADD https-certs /container/service/phpmyadmin/assets/apache2/certs
ADD database-certs /container/service/mariadb-client/assets/certs
ADD my-config.inc.php /container/service/phpmyadmin/assets/config/config.inc.php
ADD environment /container/environment/01-custom

Make your own phpMyAdmin image

Clone this project :

git clone https://github.com/osixia/docker-phpMyAdmin
cd docker-phpMyAdmin

Adapt Makefile, set your image NAME and VERSION, for example :

NAME = osixia/phpmyadmin
VERSION = 4.7.2

becomes :
NAME = billy-the-king/phpmyadmin
VERSION = 0.1.0

Add your custom certificate, environment files, config.inc.php ...

Build your image :

make build

Run your image :

docker run -d billy-the-king/phpmyadmin:0.1.0

Tests

We use Bats (Bash Automated Testing System) to test this image:

https://github.com/sstephenson/bats

Install Bats, and in this project directory run :

make test

Kubernetes

Kubernetes is an open source system for managing containerized applications across multiple hosts, providing basic mechanisms for deployment, maintenance, and scaling of applications.

More information:

A kubernetes example is available in example/kubernetes

Under the hood: osixia/web-baseimage

This image is based on osixia/web-baseimage. More info: https://github.com/osixia/docker-web-baseimage

Security

If you discover a security vulnerability within this docker image, please send an email to the Osixia! team at security@osixia.net. For minor vulnerabilities feel free to add an issue here on github.

Please include as many details as possible.

Changelog

Please refer to: CHANGELOG.md