docker.recipes

Adminer + Multiple Database Types

beginner

Lightweight database management in a single PHP file.

Overview

Adminer is a full-featured database management tool written entirely in a single PHP file, originally developed as a lightweight alternative to phpMyAdmin. Despite its minimal footprint of just 470KB, Adminer supports multiple database systems including MySQL, PostgreSQL, SQLite, MS SQL, Oracle, and MongoDB, making it an incredibly versatile tool for database administration. Its clean interface and zero-configuration approach have made it popular among developers who need quick database access without the complexity of larger administration tools. This stack combines Adminer with PostgreSQL 15 and MySQL 8.0, creating a comprehensive database testing and development environment. The configuration allows you to switch between different database systems from a single web interface, making it ideal for applications that need to support multiple database backends or for comparing query performance across different engines. Adminer connects to each database server through the internal Docker network, providing secure access while exposing only the web interface to the host system. Developers working on multi-database applications, database administrators managing heterogeneous environments, and teams evaluating different database technologies will find this stack particularly valuable. The combination eliminates the need to install separate management tools for each database type, while the containerized approach ensures consistent behavior regardless of the host operating system. Educational environments also benefit from this setup, as students can explore different SQL dialects and database features from a unified interface.

Key Features

  • Single PHP file deployment requiring only 470KB of disk space
  • Native support for MySQL, PostgreSQL, SQLite, MS SQL, Oracle, and MongoDB
  • Built-in SQL editor with syntax highlighting and query execution
  • Database schema visualization and table structure editing
  • CSV, SQL, and TSV export capabilities for data migration
  • Plugin system supporting tables-filter and tinymce rich text editing
  • Multiple visual themes including Nette, Pepa, and Hydra designs
  • Cross-database query comparison and performance analysis tools

Common Use Cases

  • 1Multi-database application development requiring PostgreSQL and MySQL compatibility testing
  • 2Database migration projects comparing schema and data between different engines
  • 3Educational environments teaching SQL across multiple database systems
  • 4Development teams prototyping applications with different database backends
  • 5Legacy system maintenance where multiple database types coexist
  • 6Quick database troubleshooting and query debugging in containerized environments
  • 7Small to medium businesses managing diverse database infrastructure from a single interface

Prerequisites

  • Docker Engine 20.10+ and Docker Compose 2.0+ installed
  • Minimum 1GB RAM available for PostgreSQL and MySQL containers
  • Port 8080 available on the host system for Adminer web interface
  • Basic understanding of SQL and database concepts
  • Environment variables configured for POSTGRES_USER, POSTGRES_PASSWORD, and MYSQL_ROOT_PASSWORD
  • Familiarity with different SQL dialects if working across multiple database types

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 adminer:
3 image: adminer:latest
4 environment:
5 - ADMINER_DEFAULT_SERVER=postgres
6 - ADMINER_DESIGN=nette
7 - ADMINER_PLUGINS=tables-filter tinymce
8 ports:
9 - "8080:8080"
10 networks:
11 - adminer-network
12 restart: unless-stopped
13
14 postgres:
15 image: postgres:15
16 environment:
17 - POSTGRES_USER=${POSTGRES_USER}
18 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
19 - POSTGRES_DB=demo
20 volumes:
21 - postgres-data:/var/lib/postgresql/data
22 networks:
23 - adminer-network
24 restart: unless-stopped
25
26 mysql:
27 image: mysql:8.0
28 environment:
29 - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
30 - MYSQL_DATABASE=demo
31 volumes:
32 - mysql-data:/var/lib/mysql
33 networks:
34 - adminer-network
35 restart: unless-stopped
36
37volumes:
38 postgres-data:
39 mysql-data:
40
41networks:
42 adminer-network:
43 driver: bridge

.env Template

.env
1# Adminer
2POSTGRES_USER=postgres
3POSTGRES_PASSWORD=secure_postgres_password
4MYSQL_ROOT_PASSWORD=secure_root_password

Usage Notes

  1. 1Adminer at http://localhost:8080
  2. 2Server: postgres or mysql
  3. 3Single file, lightweight
  4. 4Multiple themes available
  5. 5SQL export/import

Individual Services(3 services)

Copy individual services to mix and match with your existing compose files.

adminer
adminer:
  image: adminer:latest
  environment:
    - ADMINER_DEFAULT_SERVER=postgres
    - ADMINER_DESIGN=nette
    - ADMINER_PLUGINS=tables-filter tinymce
  ports:
    - "8080:8080"
  networks:
    - adminer-network
  restart: unless-stopped
postgres
postgres:
  image: postgres:15
  environment:
    - POSTGRES_USER=${POSTGRES_USER}
    - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    - POSTGRES_DB=demo
  volumes:
    - postgres-data:/var/lib/postgresql/data
  networks:
    - adminer-network
  restart: unless-stopped
mysql
mysql:
  image: mysql:8.0
  environment:
    - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
    - MYSQL_DATABASE=demo
  volumes:
    - mysql-data:/var/lib/mysql
  networks:
    - adminer-network
  restart: unless-stopped

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 adminer:
5 image: adminer:latest
6 environment:
7 - ADMINER_DEFAULT_SERVER=postgres
8 - ADMINER_DESIGN=nette
9 - ADMINER_PLUGINS=tables-filter tinymce
10 ports:
11 - "8080:8080"
12 networks:
13 - adminer-network
14 restart: unless-stopped
15
16 postgres:
17 image: postgres:15
18 environment:
19 - POSTGRES_USER=${POSTGRES_USER}
20 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
21 - POSTGRES_DB=demo
22 volumes:
23 - postgres-data:/var/lib/postgresql/data
24 networks:
25 - adminer-network
26 restart: unless-stopped
27
28 mysql:
29 image: mysql:8.0
30 environment:
31 - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
32 - MYSQL_DATABASE=demo
33 volumes:
34 - mysql-data:/var/lib/mysql
35 networks:
36 - adminer-network
37 restart: unless-stopped
38
39volumes:
40 postgres-data:
41 mysql-data:
42
43networks:
44 adminer-network:
45 driver: bridge
46EOF
47
48# 2. Create the .env file
49cat > .env << 'EOF'
50# Adminer
51POSTGRES_USER=postgres
52POSTGRES_PASSWORD=secure_postgres_password
53MYSQL_ROOT_PASSWORD=secure_root_password
54EOF
55
56# 3. Start the services
57docker compose up -d
58
59# 4. View logs
60docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/adminer-multi-db/run | bash

Troubleshooting

  • Connection failed to database server: Verify the server name matches the Docker service name (postgres or mysql) in Adminer login
  • MySQL authentication plugin error: Add --default-authentication-plugin=mysql_native_password to MySQL command or use mysql:5.7 image
  • PostgreSQL connection refused: Ensure POSTGRES_USER and POSTGRES_PASSWORD environment variables are set and containers are fully started
  • Adminer shows blank page: Check PHP memory limits and ensure port 8080 is not blocked by firewall
  • Cannot import large SQL files: Increase PHP upload limits by mounting custom php.ini with higher upload_max_filesize and post_max_size
  • Tables not visible in Adminer: Verify database user has proper SELECT privileges and the correct database/schema is selected

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space