7/4/2023
Docker on QNAP NAS — a server at a fraction of VPS cost
TL;DR: QNAP NAS with Container Station is a full Docker environment for free (if you already have a NAS). 8 GB RAM handles 10+ production containers. SSH on port 222, docker compose up.
When you’re running several projects at once and don’t want to pay for a separate VPS for each one, it’s worth looking at the hardware you already have at home or in the office. A QNAP NAS — bought primarily as a backup disk — turns out to be a fully capable web application server, if you know how to configure it.
Why use a NAS as a server
QNAP NAS from the TS series (TS-453D, TS-464, TS-873A, and similar) has an x86_64 processor — Intel Celeron or equivalent. This is real Docker, not an emulation. A model with 8 GB RAM comfortably handles 10–15 containers: nginx, PHP-FPM, MariaDB, Redis, Mosquitto, InfluxDB, Grafana, and a few applications. RAM can be purchased and expanded to 16 GB for a few hundred PLN.
You buy the hardware once. RAID disks (RAID 1 or RAID 5) protect data against a single drive failure. Power consumption is around 25–40W under normal load — annual electricity cost is 100–200 PLN, not 600–1200 PLN for a VPS. For a small business or freelancer who already needs a NAS for backups, this is a very sensible solution.
Container Station
Container Station is the official QNAP application available through App Center. It installs as a QTS package and runs a full Docker daemon and optionally Kubernetes (Portainer). The Container Station GUI is decent for browsing logs and container status, but SSH + docker compose is clearly better for day-to-day work.
Path to the docker binary after installing Container Station:
/share/CACHEDEV1_DATA/.qpkg/container-station/bin/docker
It’s worth adding an alias in ~/.profile on the NAS:
alias docker='/share/CACHEDEV1_DATA/.qpkg/container-station/bin/docker'
alias docker-compose='/share/CACHEDEV1_DATA/.qpkg/container-station/bin/docker-compose'
SSH and first steps
Enable SSH in QTS via Control Panel → Terminal & SNMP → Enable SSH. The default SSH port on QNAP is 222, not 22 — worth remembering, as it causes unexpected issues with tools that assume port 22.
Logging in as admin and using sudo on QNAP has a quirk — the standard sudo command doesn’t work. Instead:
echo 'your_password' | sudo -S command
docker-compose.yml files are best kept in /share/Container/project_name/. To run them:
cd /share/Container/my_project
docker compose up -d
docker compose logs -f
Port mapping
QNAP with its default configuration occupies many ports for its own services: ports 80 and 443 are used by QTS Web (admin panel), port 8080 is often taken by another QNAP service. Trying to start nginx on port 80 will result in a conflict.
The best approach: use non-standard ports internally (e.g. 2137 for HTTP, 2138 for HTTPS) and map them through an external router. With MikroTik NAT:
/ip firewall nat add chain=dstnat dst-address=PUBLIC_IP protocol=tcp dst-port=80 action=dst-nat to-addresses=192.168.10.200 to-ports=2137
Hairpin NAT also enables access from the local network via the public IP — useful when testing.
Known pitfalls
First pitfall: nginx config. QTS keeps its nginx configuration in its own location inside the .qpkg folder. Editing a file in /share/Container/ won’t do anything — QTS copies its own version back when the service restarts. Either edit in the location QNAP specifies, or run your own nginx container independently of the system.
Second pitfall: copying files to a container over SSH. Standard docker cp works locally, but over SSH you don’t have direct access to the host filesystem from WSL. Workaround:
cat file.conf | ssh -p 222 admin@192.168.10.200 "cat > /tmp/file.conf"
ssh -p 222 admin@192.168.10.200 "docker cp /tmp/file.conf container:/etc/nginx/conf.d/"
Summary
QNAP + Container Station is a solid solution for small businesses and freelancers who need their own Docker environment without monthly VPS costs. Operating costs come down to electricity. The main drawback is the lack of easy horizontal scaling — but for 1–10 web projects, that simply doesn’t matter. If you have a QNAP NAS and aren’t using it as an application server, you’re wasting potential you’ve already paid for.