version: '3.6'

services:
  mongo:
    image: mongo
    restart: always
    ports:
      - 27017:27017
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: root
    volumes:
      - 'mongodb:/data/db'
      - 'mongodbbackup:/backup'

volumes:
  mongodb:
    driver: local
    driver_opts:
      type: none
      device: "$PWD/_db"
      o: bind

  mongodbbackup:
    driver: local
    driver_opts:
      type: none
      device: "$PWD/_backup"
      o: bind

