Public | Automated Build

Last pushed: 3 years ago
Short Description
An Ubuntu 14.04 based image, featuring s6 process management and MongoDB.
Full Description


An image for using mongodb within Docker containers.

Yet another container for running MongoDB?

Yes, as this one is built from my Ubuntu-based Docker image that contains s6 for process management.

Aren't you only supposed to run one process per container?

Well yes and no... the following are good examples of when multiple processes within one container might be necessary:

  • automatically updating nginx proxy settings when a down-stream application server (nodejs, php, etc) restarts (and the IP changes)
  • automatically updating HAProxy configuration to load balance to a group of down-stream application servers
  • running a logging daemon to centralize log management (i.e. logentries, loggly, logstash)
  • when you need to run a script on application server crash (to tidy something up), as the standard Docker container restart policies won't provide this


To use this image include FROM smebberson/mongodb at the top of your Dockerfile, or simply docker run --name mongodb smebberson/mongodb.

Disable hugepage

By default, you'll probably notice MongoDB complaining about hugepage when it starts up. The s6 startup script has support to disable this, but you need to run the container in privileged mode:

docker run --privileged --name mongodb smebberson/mongodb`


This container comes setup as follows:

  • s6 will automatically start mongod for you
  • if mongod dies, it will automatically be restarted
  • mongod is run as the mongodb user

To customise the start up process for mongod, during your Dockerfile build process, copy across a file to /etc/s6/mongodb/run. This file will be used to start mongod. Within it, start mongod after performing any setup steps as required.

Docker Pull Command
Source Repository