php my Admin Documentation chapter 3 3.2

 To connect phpMyAdmin to more servers use:

docker run --name myadmin -d -e PMA_HOSTS=dbhost1,dbhost2,dbhost3 -p 8080:80

˓→phpmyadmin/phpmyadmin

To use arbitrary server option:

docker run --name myadmin -d --link mysql_db_server:db -p 8080:80 -e PMA_ARBITRARY=1

˓→phpmyadmin/phpmyadmin

You can also link the database container using Docker:

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

˓→phpmyadmin

Running with additional configuration:

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/

˓→phpmyadmin

Running with additional themes:

docker run --name phpmyadmin -d --link mysql_db_server:db -p 8080:80 -v /custom/

˓→phpmyadmin/theme/:/www/themes/theme/ phpmyadmin/phpmyadmin

3.5.5 Using docker-compose

Alternatively you can also use docker-compose with the docker-compose.yml from <https://github.com/phpmyadmin/

docker>. This will run phpMyAdmin with an arbitrary server - allowing you to specify MySQL/MariaDB server on

login page.

docker-compose up -d

3.5.6 Customizing configuration file using docker-compose

You can use an external file to customize phpMyAdmin configuration and pass it using the volumes directive:

phpmyadmin:

image: phpmyadmin/phpmyadmin

container_name: phpmyadmin

environment:

- PMA_ARBITRARY=1

restart: always

ports:

- 8080:80

volumes:

- /sessions

- ~/docker/phpmyadmin/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php

- /custom/phpmyadmin/theme/:/www/themes/theme/ 


 3.5.7 Running behind haproxy in a subdirectory




When you want to expose phpMyAdmin running in a Docker container in a subdirectory, you need to rewrite the
request path in the server proxying the requests.




For example using haproxy it can be done as:




frontend http
bind *:80
option forwardfor
option http-server-close
### NETWORK restriction
acl LOCALNET src 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12
# /phpmyadmin
acl phpmyadmin path_dir /phpmyadmin
use_backend phpmyadmin if phpmyadmin LOCALNET
backend phpmyadmin
mode http
reqirep ^(GET|POST|HEAD)\ /phpmyadmin/(.*) \1\ /\2
# phpMyAdmin container IP
server localhost 172.30.21.21:80
When using traefik, something like following should work:
defaultEntryPoints = ["http"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
regex = "(http:\\/\\/[^\\/]+\\/([^\\?\\.]+)[^\\/])$"
replacement = "$1/"
[backends]
[backends.myadmin]
[backends.myadmin.servers.myadmin]
url="http://internal.address.to.pma"
[frontends]
[frontends.myadmin]
backend = "myadmin"
passHostHeader = true
[frontends.myadmin.routes.default]
rule="PathPrefixStrip:/phpmyadmin/;AddPrefix:/"
You then should specify PMA_ABSOLUTE_URI in the docker-compose configuration:
version: '2'
services:
phpmyadmin:
restart: always
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
hostname: phpmyadmin 


 Chapter 3 3.3 coming soon


Popular Posts