Dockerized phpMyAdmin Cheatsheet
Examples
Standalone Deployment
If you just want to deploy a phpmyadmin instance, that you then use to connect to any number of other hosts on the internet, then you could do this:
services:
phpmyadmin:
image: phpmyadmin:5.2-apache
container_name: phpmyadmin
restart: unless-stopped
ports:
- "80:80"
However, this is generally not very useful, and your starting point is probably going to be the internally connected setup outlined below.
Internally Networked Setup
This is a minimal example setup (you probably want to add logging clauses etc), in which I am running phpMyAdmin to access a database on the same host through the internal networking, allowing me to not have the database port exposed to the internet. I am also accessing phpmyadmin on a custom port of 8080, because my web app is using port 80.
services:
phpmyadmin:
image: phpmyadmin:5.2-apache
container_name: phpmyadmin
restart: unless-stopped
depends_on:
- db
ports:
- "8080:80"
# A database to be accessed/managed through phpMyAdmin
db:
image: mariadb:11.6-noble
container_name: db
restart: always
volumes:
- db-data:/var/lib/mysql
# Uncomment this ports section if wish for database to be
# accessible from the outside world, but you probably don't
# need to if you can already access it through phpMyAdmin
#ports:
# - 3306:3306
environment:
- MYSQL_DATABASE=${DB_NAME}
- MYSQL_USER=${DB_USER}
- MYSQL_PASSWORD=${DB_USER_PASSWORD}
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
# A representation of your custom application
# that uses your MariaDB database
app:
container_name: app
image: myCustomWebApp
restart: unless-stopped
ports:
- "80:80"
depends_on:
- db
volumes:
db-data:
driver: local
No Login Required
You can automatically provide phpMyAdmin the username and password to use so that there is no login required.
services:
phpmyadmin:
image: phpmyadmin:5.2-apache
container_name: phpmyadmin
restart: always
ports:
- "8080:80"
environment:
- PMA_HOST=${DB_HOST}
- PMA_USER=root
- PMA_PASSWORD=${DB_ROOT_PASSWORD}
SSL/TLS Support
Unfortunately, the official Docker image for phpMyAdmin does not have native support for adding TLS certificates. However, it is super easy to build your own custom image to add this yourself, or you can just use my pre-built image (programster/phpmyadmin) using the same code.
Since the image is built using the official image as a base image, all of the customizations performed through environment variables still work.
Increased Max Upload Size
If you need to import a larger than tiny database into phpMyAdmin, then you will need to customize the max upload size
by providing the UPLOAD_LIMIT environment variable like below:
phpmyadmin:
image: phpmyadmin:5.2-apache
container_name: phpmyadmin
environment:
- UPLOAD_LIMIT=1024000k
First published: 16th January 2026