Giter Club home page Giter Club logo

docker-mongo-auth2's Introduction

docker-mongo-auth

A Docker Image for MongoDB which makes it easy to create an Admin, a Database and a Database User when the container is first launched.

Thanks to

=========

Aashrey Sharma for docker-mongo-auth

Customization

There are a number of environment variables which you can specify to customize the username and passwords of your users.

  • With Dockerfile apply AUTH_TYPE=STRING

    # ENV AUTH YES
    # ENV AUTH_TYPE STRING
    # ENV MONGODB_ADMIN_USER root
    # ENV MONGODB_ADMIN_PASS password
    # ENV MONGODB_APPLICATION_DATABASE your_db
    # ENV MONGODB_APPLICATION_USER user
    # ENV MONGODB_APPLICATION_PASS password
    
  • With Dockerfile apply AUTH_TYPE=SECRETS

    # ENV AUTH YES
    # ENV AUTH_TYPE SECRETS
    # ENV MONGODB_ADMIN_USER /run/secrets/[root_username]
    # ENV MONGODB_ADMIN_PASS /run/secrets/[root_userpass]
    # ENV MONGODB_APPLICATION_DATABASE /run/secrets/[app_database_name]
    # ENV MONGODB_APPLICATION_USER /run/secrets/[app_username]
    # ENV MONGODB_APPLICATION_PASS /run/secrets/[app_userpass]
    
  • With docker-compose.yml apply AUTH_TYPE=STRING

    services:
      db:
        image: mttjsc/mongo-auth2:latest
        environment:
          - AUTH=YES
          - AUTH_TYPE=STRING
          - MONGODB_ADMIN_USER=root
          - MONGODB_ADMIN_PASS=root
          - MONGODB_APPLICATION_DATABASE=mytestdatabase
          - MONGODB_APPLICATION_USER=testuser
          - MONGODB_APPLICATION_PASS=testpass
        ports:
          - "27017:27017"
    // more configuration
    
  • With docker-compose.yml apply AUTH_TYPE=SECRETS

    services:
      db:
        image: mttjsc/mongo-auth2:latest
        environment:
          - AUTH=YES
          - AUTH_TYPE=SECRETS
          - MONGODB_ADMIN_USER=/run/secrets/[root_username]
          - MONGODB_ADMIN_PASS=/run/secrets/[root_userpass]
          - MONGODB_APPLICATION_DATABASE=/run/secrets/[app_database_name]
          - MONGODB_APPLICATION_USER=/run/secrets/[app_username]
          - MONGODB_APPLICATION_PASS=/run/secrets/[app_userpass]
        ports:
          - "27017:27017"
    // more configuration
    
  • With command line

    docker run -it \
      -e AUTH=YES \
      -e AUTH=STRING \
      -e MONGODB_ADMIN_USER=root \
      -e MONGODB_ADMIN_PASS=root \
      -e MONGODB_APPLICATION_DATABASE=mytestdatabase \
      -e MONGODB_APPLICATION_USER=testuser \
      -e MONGODB_APPLICATION_PASS=testpass \
      -p 27017:27017 mttjsc/mongo-auth2:latest
    

Find the image on Docker Cloud @ https://hub.docker.com/r/mttjsc/mongo-auth2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.