
Running MongoDB and Compass Web on QNAP Container Station with Persistent Storage
Learn how to run MongoDB with persistent storage and use a browser-based Compass GUI via QNAP Container Station. Perfect for home lab users exploring databases.
🧰 MongoDB + QNAP = Flexible Home Lab Database Setup
So you’re running a home lab on a QNAP NAS and want to tinker with MongoDB — maybe build a little microservice, test some queries, or just learn the ropes. But the desktop MongoDB Compass is clunky and doesn’t play nice across devices. Enter: MongoDB + QNAP Container Station + Compass Web, all from your browser.
Let’s break down how to:
Install MongoDB in QNAP Container Station with persistent storage
Fix shell issues when running MongoDB 6.0+
Deploy a browser-based Compass Web GUI on port 8088
Figure out your MongoDB connection string for app use
📦 Step 1: Set Up Persistent Storage for MongoDB
QNAP makes data persistence easy — but you’ve gotta map your volumes right. In File Station:
Create a new shared folder like:
/share/Container/MongoDB/db/share/Container/MongoDB/configdb
Then, in Container Station:
Search for the official mongo image
Click Advanced Settings
Under Volumes, map:
/share/Container/MongoDB/db → /data/db/share/Container/MongoDB/configdb → /data/configdb
Under Ports, expose 27017
Under Network, choose Default (NAT) for port mapping
💡 This keeps your MongoDB data safe even if the container is deleted or crashes.
🐚 Step 2: Fix the “mongo: not found” Problem
If you’re running MongoDB 6.0+ and you try to open a terminal and run:
mongo admin
You’ll hit this lovely error:
/bin/sh: 1: mongo: not found
That’s because MongoDB removed the legacy mongo shell. The fix?
Use the new mongosh:
mongosh admin
Now you’re in. To create your admin user:
db.createUser({ user: "adminUser", pwd: "strongPassword", roles: [{ role: "userAdminAnyDatabase", db: "admin" }] });
You’ll see something like { ok: 1 }. That means it worked. ✅
🖥️ Step 3: Deploy MongoDB Compass Web (Browser GUI)
You don’t need a desktop app to browse your MongoDB collections. There’s a handy containerised GUI called haohanyang/compass-web.
In Container Station:
Search Docker Hub for haohanyang/compass-web
Click Create
In Advanced Settings:
Under Network:
Select Default (NAT)
Expose container port 8080
Map it to host port 8088 (Could be any port that is available on your NAS)
Enable “Default web URL port” and set it to 8088
Now fire it up and visit:
http://<your-nas-ip>:8088
Boom - you’ve got a full MongoDB GUI in your browser. Create databases, collections, and inspect documents… all without installing a thing on your PC.
🔌 Step 4: Figure Out Your MongoDB Connection String
You ’ll need the connection string to link MongoDB with apps or Compass. Here’s the format:
mongodb://<user>:<password>@<host>:<port>/<database>?authSource=admin
Example:
mongodb://adminUser:[email protected]:27017/mydb?authSource=admin
Where:
adminUser and strongPassword = from db.createUser(...)
192.168.1.100 = your NAS IP
27017 = port mapped in Container Station
mydb = your database name
You can test this in Compass Web (on port 8088), in a script, or even from another container.
✅ What You’ve Learned
How to run MongoDB on your QNAP NAS with persistent storage
How to fix shell issues using mongosh
How to use Compass Web in a browser on port 8088
How to build a valid MongoDB connection string
QNAP’s Container Station is an underrated gem for homelab tinkering. It’s like having a cloud in your cupboard — and now, it runs MongoDB like a champ. If you need help wiring this up to an app, setting up CI/CD, or managing secrets, just give me a shout.