docker-compose.yml

version: '3.1'
services:
  mongo:
    image: mongo:bionic
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: ...
    ports:
      - 27018:27017
    volumes:
      - type: bind
        source: ./db
        target: /data/db