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
- Synology DS718+ with 2GB RAM by default
- Kingston 8 GB RAM Extension
- WD RED 6 TB Primary HDD
- WD RED 6 TB Secondary HDD
- 128 GB SanDisk Ultra External USB
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
MongoDB in the official Docker Registry and right-click on
mongodb to download the image. I have used the version 4 (
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
Enable AutoStart - if you want
AutoStart means the Docker Container will automatically start, if your System starts. This makes sense.
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_USERNAMEto mount path
/data/db- not read-only
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.
You need two required environment variables. I have not touched the default environment variables.
- The var
MONGO_INITDB_ROOT_USERNAMErepresents your admin username like
- The var
MONGO_INITDB_ROOT_PASSWORDrepresents your admin password like
Ready. You can now start and run MongoDB.
By default MongoDB has no administration tool on board.
You can use the free tool https://robomongo.org/ 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.