Run MongoDB in Docker on your Synology

Run MongoDB in Docker on your Synology

Run MongoDB in Docker on your Synology

If you have a Synology with an x86 CPU it is very easy to run Docker Containers on your Synology. If you have a ARM-based Synology systems, this does not work, because most of the Docker Images requires a x86 architecture

My Setup

Install Docker from the Package Center

Open your Package Center, search for Docker in the top-bar and install the Docker package.

If the package is installed, open Docker.

Load MongoDB from registry

Search for MongoDB in the official Docker Registry and right-click on mongodb to download the image. I have used the version 4 (mongo:4)

Launch MongoDB

Click on the downloaded MongoDB image and press the Launch button. A window opens where you can configure your MongoDB container.

Setup Name and limit Resources

If you want to limit the resource to a container, you can set the priority and max RAM-usage. 1 GB of RAM for MongoDB means it can hold aprx. 100.000 entries in RAM.

Setup Advanced Settings

On the same window you have a button Advanced Settings

Enable AutoStart - if you want

AutoStart means the Docker Container will automatically start, if your System starts. This makes sense.

Volume

Map a folder for your data. Otherwise your data will be inside your container! This means you will not be able to upgrade your container to a new MongoDB version and you will lose all data if you delete your container.

My mapping is:

  • Local folder MONGO_INITDB_ROOT_USERNAME to mount path /data/db - not read-only

Port Settings

By default MongoDB listens to 27017. You can use any unused port, the default port or you let Synology automatically set a port.

You do not need any settings here.

Environment

You need two required environment variables. I have not touched the default environment variables.

  • The var MONGO_INITDB_ROOT_USERNAME represents your admin username like YourAdminNameHere
  • The var MONGO_INITDB_ROOT_PASSWORD represents your admin password like YourPassword777!Here

Ready. You can now start and run MongoDB.

Admin Tool

By default MongoDB has no administration tool on board.

You can use the free tool Robomongo to connect to your MongoDB Instance. Use you synology adress and your MongoDB port to connect with your credentials you've set in your Docker environment variables.