Quick postgres database with docker compose

If you need a quick postgres or mysql database with adminer, create a docker-compose.yml file with this content:

version: '3'
services:
  mysql:
    image: mysql:5.6
    environment:
      MYSQL_DATABASE: kisphp
      MYSQL_ROOT_PASSWORD: kisphp
    ports:
      - "3306:3306"

  postgres:
    image: postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: kisphp
      POSTGRES_USER: root
      POSTGRES_DB: kisphp
    ports:
      - "5432:5432"

  adminer:
    image: adminer
    restart: always
    ports:
      - "8080:8080"

It might be needed that you add the following line in your /etc/hosts file:

127.0.0.1 mysql postgres adminer

After creating the docker compose file, make sure you have docker installed and run the following command to run it:

docker-compose up

# or to run in background
docker-compose up -d

If you want to stop it run

docker-compose stop

And if you want to remove the containers:

docker-compose rm