Sign inSign up

msav/adminer-autologin

By msav

•Updated 8 months ago

Adminer auto-login plugin for seamless database access in dev containers

Image
Developer tools
Databases & storage
0

1.6K

msav/adminer-autologin repository overview

⁠Adminer Auto-Login

Docker Hub GitHub Container Registry License: MIT

Adminer plugin for automatic database login in development environments. Reads credentials from environment variables and bypasses the login form on first request.

⁠Overview

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:

  • Automatic login on container start
  • Support for MySQL, PostgreSQL, SQLite, Oracle, MS SQL, MongoDB, and Elasticsearch
  • Configurable base path for reverse proxy deployments
  • Multi-architecture Docker image (amd64, arm64)
  • Built-in health check

Warning: This plugin disables authentication entirely. Use only in development environments where the database interface is not exposed to untrusted networks.

⁠Quick Start

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.

⁠Installation

⁠Docker

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
⁠Docker Compose

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
⁠MySQL Example
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
⁠Native Installation (Without Docker)

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:

  • Adminer 5.0.0 or later
  • PHP 8.0 or later

Steps:

  1. Download autologin.php from this repository
  2. Place it in your Adminer plugins directory (typically plugins-enabled/)
  3. Set environment variables in your PHP-FPM pool or web server:

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;

⁠Configuration

⁠Environment Variables
VariableRequiredDefaultDescription
ADMINER_DRIVERNoserverDatabase driver (see supported drivers below)
ADMINER_SERVERYes—Database host address
ADMINER_USERNAMEYes—Database username
ADMINER_PASSWORDNoemptyDatabase password
ADMINER_DBNoemptyDefault database to select after login
ADMINER_BASE_PATHNo/Base URL path for reverse proxy setups
⁠Supported Drivers
DriverDatabase
serverMySQL / MariaDB
pgsqlPostgreSQL
sqliteSQLite 3
sqlite2SQLite 2
oracleOracle
mssqlMicrosoft SQL Server
mongoMongoDB
elasticElasticsearch

If an unrecognized driver is specified, the plugin defaults to MySQL (server).

⁠Use Cases

⁠Behind a Reverse Proxy

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"
⁠Using Environment Files

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

⁠Troubleshooting

⁠Auto-login not triggered

If you see the message "Auto-login not triggered" instead of the database interface:

  • Verify that both ADMINER_SERVER and ADMINER_USERNAME are set
  • Check that environment variables are passed correctly to the container
  • Inspect container environment: docker exec <container> env | grep ADMINER
⁠Connection refused or timeout
  • Confirm the database container is running and healthy
  • Verify the ADMINER_SERVER value matches the database service name (in Compose) or hostname
  • Check that the database accepts connections from the Adminer container network
  • Test connectivity: docker exec <adminer-container> nc -zv <db-host> <port>
⁠Wrong database type
  • The plugin defaults to MySQL if ADMINER_DRIVER is not set or contains an invalid value
  • Check the supported drivers list and use exact values (case-sensitive)
⁠Redirect loop
  • If accessing through a reverse proxy, ensure ADMINER_BASE_PATH matches the proxy path exactly
  • The path should not have a trailing slash (use /adminer, not /adminer/)

⁠License

MIT License. See LICENSE⁠ for details.

Tag summary

Content type

Image

Digest

sha256:3abeb002d…

Size

44.2 MB

Last updated

8 months ago

docker pull msav/adminer-autologin