Skip to content

tklx/mongodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tklx/mongodb - NoSQL database

CircleCI

MongoDB (from "humongous") is a scalable, high-performance document-oriented NoSQL database system. Instead of storing data in tables as is done in a "classical" relational database, MongoDB stores structured data as JSON-like documents with dynamic schemas, making integration with certain types of applications easier and faster.

Features

  • Based on the super slim tklx/base (Debian GNU/Linux).
  • MongoDB installed from official upstream repo.
  • Uses tini for zombie reaping and signal forwarding.
  • Includes USER mongodb to restrict the privileges of mongod.
  • Includes VOLUME /data/db for dbPath persistence.
  • Includes EXPOSE 27017, so standard container linking will make it automatically available to the linked containers.

Usage

Start a mongodb instance and connect to it from an application

$ docker run --name some-mongo -d tklx/mongodb
$ docker run --name some-app --link some-mongo:mongo -d app-that-uses-mongo

Authentication and Authorization

MongoDB does not require authentication by default, but it can be configured to do so. For more details about the functionality described here, please see the sections in the official documentation which describe authentication and authorization in more detail.

$ docker run --name some-mongo -d tklx/mongodb --auth

$ docker exec -it some-mongo mongo admin
connecting to: admin
> db.createUser({ user: 'some-user', pwd: 'some-pass', roles: [ { role: 'userAdminAnyDatabase', db: 'admin' } ] })
Successfully added user: {
        "user" : "some-user",
        "roles" : [
                {
                        "role" : "userAdminAnyDatabase",
                        "db" : "admin"
                }
        ]
}

$ docker run -it --rm --link some-mongo:mongo tklx/mongodb \
     mongo -u some-user -p some-pass --authenticationDatabase admin \
     some-mongo/some-db
connecting to: some-mongo/some-db
> db.getName()
some-db

Tips

# interactive root terminal
$ docker run --rm -it -u root tklx/mongodb /bin/bash

# mongo client options
$ docker run --rm tklx/mongodb mongo --help

# mongod options
$ docker run --rm tklx/mongodb --help

# while testing
$ docker run --name test-mongo -d tklx/mongodb --smallfiles --noprealloc

Automated builds

The Docker image is built, tested and pushed by CircleCI from source hosted on GitHub.

  • Tag: x.y.z refers to a release (recommended).
  • Tag: latest refers to the master branch.

Status

Currently on major version zero (0.y.z). Per Semantic Versioning, major version zero is for initial development, and should not be considered stable. Anything may change at any time.

Issue Tracker

TKLX uses a central issue tracker on GitHub for reporting and tracking of bugs, issues and feature requests.