Adminer auto-login plugin for seamless database access in dev containers
1.6K
Adminer plugin for automatic database login in development environments. Reads credentials from environment variables and bypasses the login form on first request.
This plugin extends the official Adminer Docker image to provide seamless database access without manual authentication. Configure your database connection through environment variables, and the plugin handles login automatically.
Key features:
Warning: This plugin disables authentication entirely. Use only in development environments where the database interface is not exposed to untrusted networks.
docker run -p 8080:8080 \
-e ADMINER_SERVER=your-db-host \
-e ADMINER_USERNAME=your-user \
-e ADMINER_PASSWORD=your-password \
msav/adminer-autologin
Open http://localhost:8080 to access the database immediately.
Pull from Docker Hub:
docker pull msav/adminer-autologin
Or from GitHub Container Registry:
docker pull ghcr.io/mvandrew/adminer-autologin
Run with all configuration options:
docker run -p 8080:8080 \
-e ADMINER_DRIVER=pgsql \
-e ADMINER_SERVER=postgres \
-e ADMINER_USERNAME=postgres \
-e ADMINER_PASSWORD=postgres \
-e ADMINER_DB=mydb \
-e ADMINER_BASE_PATH=/ \
msav/adminer-autologin
Create a docker-compose.yml file:
services:
db:
image: postgres:17-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: appdb
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
adminer:
image: msav/adminer-autologin
ports:
- "8080:8080"
environment:
ADMINER_DRIVER: pgsql
ADMINER_SERVER: db
ADMINER_USERNAME: postgres
ADMINER_PASSWORD: postgres
ADMINER_DB: appdb
depends_on:
db:
condition: service_healthy
volumes:
pgdata:
Start the stack:
docker compose up -d
services:
mysql:
image: mysql:8
environment:
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_DATABASE: appdb
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 5s
timeout: 5s
retries: 5
adminer:
image: msav/adminer-autologin
ports:
- "8080:8080"
environment:
ADMINER_DRIVER: server
ADMINER_SERVER: mysql
ADMINER_USERNAME: root
ADMINER_PASSWORD: rootpass
ADMINER_DB: appdb
depends_on:
mysql:
condition: service_healthy
If you run Adminer directly on a host machine, copy autologin.php to the Adminer plugins directory and set the required environment variables in your web server configuration.
Requirements:
Steps:
autologin.php from this repositoryplugins-enabled/)Apache (in virtualhost or .htaccess):
SetEnv ADMINER_SERVER localhost
SetEnv ADMINER_USERNAME dbuser
SetEnv ADMINER_PASSWORD dbpass
SetEnv ADMINER_DRIVER server
Nginx with PHP-FPM (in location block):
fastcgi_param ADMINER_SERVER localhost;
fastcgi_param ADMINER_USERNAME dbuser;
fastcgi_param ADMINER_PASSWORD dbpass;
fastcgi_param ADMINER_DRIVER server;
| Variable | Required | Default | Description |
|---|---|---|---|
ADMINER_DRIVER | No | server | Database driver (see supported drivers below) |
ADMINER_SERVER | Yes | — | Database host address |
ADMINER_USERNAME | Yes | — | Database username |
ADMINER_PASSWORD | No | empty | Database password |
ADMINER_DB | No | empty | Default database to select after login |
ADMINER_BASE_PATH | No | / | Base URL path for reverse proxy setups |
| Driver | Database |
|---|---|
server | MySQL / MariaDB |
pgsql | PostgreSQL |
sqlite | SQLite 3 |
sqlite2 | SQLite 2 |
oracle | Oracle |
mssql | Microsoft SQL Server |
mongo | MongoDB |
elastic | Elasticsearch |
If an unrecognized driver is specified, the plugin defaults to MySQL (server).
When deploying Adminer behind a reverse proxy at a subpath like /adminer, set ADMINER_BASE_PATH to match:
docker run -p 8080:8080 \
-e ADMINER_BASE_PATH=/adminer \
-e ADMINER_SERVER=db \
-e ADMINER_USERNAME=user \
-e ADMINER_PASSWORD=pass \
msav/adminer-autologin
Nginx proxy configuration:
location /adminer/ {
proxy_pass http://adminer:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
Traefik labels (Docker Compose):
adminer:
image: msav/adminer-autologin
environment:
ADMINER_BASE_PATH: /adminer
# ... other env vars
labels:
- "traefik.http.routers.adminer.rule=PathPrefix(`/adminer`)"
- "traefik.http.services.adminer.loadbalancer.server.port=8080"
For cleaner configuration, use an .env file:
ADMINER_DRIVER=pgsql
ADMINER_SERVER=postgres
ADMINER_USERNAME=postgres
ADMINER_PASSWORD=postgres
ADMINER_DB=appdb
Reference it in docker-compose.yml:
adminer:
image: msav/adminer-autologin
ports:
- "8080:8080"
env_file:
- .env
If you see the message "Auto-login not triggered" instead of the database interface:
ADMINER_SERVER and ADMINER_USERNAME are setdocker exec <container> env | grep ADMINERADMINER_SERVER value matches the database service name (in Compose) or hostnamedocker exec <adminer-container> nc -zv <db-host> <port>ADMINER_DRIVER is not set or contains an invalid valueADMINER_BASE_PATH matches the proxy path exactly/adminer, not /adminer/)MIT License. See LICENSE for details.
Content type
Image
Digest
sha256:3abeb002d…
Size
44.2 MB
Last updated
8 months ago
docker pull msav/adminer-autologin