Play databases with Adminer and Docker

$ docker version && docker-compose version
  • Docker : 17.12.0-ce ;
  • Docker Compose : 1.17.0 ;
  • Adminer : 4.5.0 ;
  • Postgres : 10 ;
  • MySQL : 8.0.3 ;
  • MongoDB : 3.6.2

Install Adminer

version: '3.1'   services:       adminer:           image: dockette/adminer:full-php5           restart: always           ports:              - 8080:8080
  • “dockette/adminer:full-php5” is an unofficial image working with PHP 5 instead of PHP 7 ;
  • “restart” the container will be restart each time when the Docker service will be up ;
  • “8080” on the left side is the external port. If this port is already using you should change it ;
  • “8080” on the right side is the internal port. Please don’t change !
$ docker-compose up

Postgres

Prepare the server

dbPostgres:    image: postgres:10    restart: always    ports:        - 5432:5432    environment:        POSTGRES_USER: root        POSTGRES_PASSWORD: changeme        POSTGRES_DB: mydb
  • “postgres:10” is the official image of the 10 version ;
  • “restart: always” means restart the service each time the Docker daemon is restarted ;
  • “5432” (on the left side) is the external port. If this port is already using you should change it ;
  • “5432” (on the right side) is the internal port. Please don’t change it!
  • “POSTGRES_USER” is the login ;
  • “POSTGRES_PASSWORD” is the password ;
  • “POSTGRES_DB” is the name of the database.
$ docker-compose up

Connection with Adminer and Postgres

  • “System” : select “PostgresSQL” ;
  • “Server” : type “dbPostgres” ;
  • “Username” : type “root” ;
  • “Password” : type “changeme” ;
  • “Database” : type “mydb” ;
  • Click “login” button.

MySQL

Prepare the server

dbMysql:    image: mysql:8.0.3    restart: always    environment:        MYSQL_ROOT_PASSWORD: changeme        MYSQL_DATABASE: mydb
  • “mysql:8.0.3” is the official image of the 8.0.3 version (or “mariadb” in you want to use MariaDB) ;
  • “restart: always” means restart the service each time the Docker daemon is restarted ;
  • “3306” (on the left side) is the external port. If this port is already using you should change it ;
  • “3306” (on the right side) is the internal port. Please don’t change it!
  • “MYSQL_ROOT_PASSWORD” is the password ;
  • “MYSQL_DATABASE” is the name of the database.
$ docker-compose up

Connection with Adminer and MySQL

  • “System” : select “MySQL” ;
  • “Server” : type “dbMysql” ;
  • “Username” : type “root” ;
  • “Password” : type “changeme” ;
  • “Database” : type “mydb” ;
  • Click “login” button.

MongoDB

dbMongo:    image: mongo:3.6.2    restart: always    ports:        - 27017:27017    environment:        MONGO_INITDB_ROOT_USERNAME: root        MONGO_INITDB_ROOT_PASSWORD: changeme
  • “mongo:3.6.2” is the official image of the 3.6.2 version ;
  • “restart: always” means restart the service each time the Docker daemon is restarted ;
  • “27017” (on the left side) is the external port. If this port is already using you should change it ;
  • “27017” (on the right side) is the internal port. Please don’t change it!
  • “MONGO_INITDB_ROOT_USERNAME” : is the login ;
  • “MONGO_INITDB_ROOT_PASSWORD” is the password root.
$ docker-compose up

Connection with Adminer and MongoDB

  • “System” : select “Mongo” ;
  • “Server” : type “dbMongo” ;
  • “Username” : type “root” ;
  • “Password” : type “changeme” ;
  • “Database” : leave empty ;
  • Click “login” button.

Global file

version: '3.1'    services:        adminer:            image: dockette/adminer:full-php5            restart: always            ports:                - 8080:8080        dbPostgres:            image: postgres:10            restart: always            ports:                - 5432:5432            environment:                POSTGRES_USER: root                POSTGRES_PASSWORD: changeme                POSTGRES_DB: mydb
dbMysql:
image: mysql:8.0.3 restart: always ports: - 3306:3306 environment: MYSQL_ROOT_PASSWORD: changeme MYSQL_DATABASE: mydb dbMongo: image: mongo:3.6.2 restart: always ports: - 27017:27017 environment: MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: changeme

Sources

--

--

--

A curious guy

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Configuring HAProxy with Backend Server Using Ansible Role | Ansible Role |Task 15 | Arth

K8s — Ingress Demo in AWS EKS

Microservices PoweredBy Domain Driven Design

Build Restful web services with Spring boot and kotlin.

The Operating System Hidden in Plain Sight

380. Insert Delete GetRandom O(1) — 12th June LeetCode Challenge

Nothing Much: Creating My Developer Portfolio (Part 12)

Hand with watch over MacBook

Concurrency vs Parallelism

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Etienne Rouzeaud

Etienne Rouzeaud

A curious guy

More from Medium

Search/Indexing JSON documents

Docker-compose + NGINX + TLS Certificates

Docker And Compose cheat sheet

Real-time Web Updates From Your PostgreSQL Database