Public Repository

Last pushed: 6 days ago
Short Description
Short description is empty for this repo.
Full Description

vegidio/mongodb



A Docker image for MongoDB with authentication enabled by default. It also has remote access enabled to facilitate the external connections.

This image inherits directly from the official MongoDB image in the Docker Store.

Usage

Pre-built image

Run the container using pre-built image vegidio/mongodb:

$ docker run -d \
    -e MONGODB_ROOT_PASSWORD='password' \
    -p 27017:27017 \
    --name mongodb vegidio/mongodb

You must replace the environment variable MONGODB_ROOT_PASSWORD for an unique and secure password. See more in the Authentication section.

Build the image

In the project root folder, type:

$ docker build -t my-mongodb-image .

Then run the container using the same command available in the Pre-built image section, but replacing vegidio/mongodb by the name of the image you just built.

Configuration

Authentication

This MongoDB image has authentication enabled by default. It means that you must use a password to access the database server.

In order to set a password you must create the environment variable MONGODB_ROOT_PASSWORD when you run the Docker container (either with the parameter -e MONGODB_ROOT_PASSWORD or through the docker-compose.yml file). If you don't create this environment variable then this image will set the default password "root" for you, but I strongly advice against using the default password! Your data can be in risk if you do this.

With the password set, a new user named root will be created in the database.

Port & Remote Connections

This container exposes MongoDB's default port 27017 for private connections. If you want to allow this container to be accessed remotely then you must map the private port to a public one, using the Docker parameter -p 27017:[public_port].

License

vegidio/mongodb is released under the Apache License. See LICENSE for details.

Author

Vinicius Egidio (vinicius.io)

Docker Pull Command
Owner
vegidio

Comments (0)