Container management on QNAP
I have two QNAP NAS’s running a variety services in Docker. Container Station is QNAP’s implementation of Docker and having it installed on both machines has really expanded what I can do with these devices. Thumbs up to that, but I do have a few tips beyond Container Station that will help you run your containers more efficiently (…at least, this is what works for me).
1) Store your persistent data in a location other than Container Station’s default folder.
Ok, so this first item is more like a soft tip… You may already know Container Station creates a shared folder named “Container” when it is installed. Inside this folder is another folder with special permissions that contains all the data files for Container Station to run + any container images. Because of this, I’ve found it easier just to keep my persistent data separated from this folder (I use /share/docker/). This seems to avoid any potential permission conflicts and makes backup configuration a little easier. YMMV.
2) Use Docker Compose to create containers.
Container Stations’s UI can be quite clunky and inefficient to create containers. Skip the UI and use Docker Compose instead.
Create a config file in YAML syntax (here’s an example creating a Portainer container)
version: '3' services: portainer: container_name: Portainer image: portainer/portainer restart: always ports: - "9000:9000" volumes: - /var/run/docker.sock:/var/run/docker.sock - /share/Docker/portainer:/data
NOTE: “Docker/portanier” in the last line can be any preferred path to store persistent data
Save the file to an easily accessible location on your QNAP device. Let’s call it “dcexample.yml”. Tip: saving it to your “/homes/USERNAME/” directory skips the need to specify a file path in step 3
SSH into your device and enter the following at the prompt:
docker-compose -f dcexample.yml up -d
Docker will now pull and unpack each container. Sit back, relax, and let the process finish. There’s nothing left for you to do.
3) Use Portainer to manage your containers
While the command line is great for creating & updating containers, having a clean UI for everyday activities like monitoring containers and viewing log activity is still quite handy. I’ve found Portainer intuitive and easy to use for this purpose (…as you may have already guessed given my example above). An added benefit if you have multiple devices, like I do, is that it allows you to control multiple docker instances from a single interface.
Here’s an example of a typical Portainer Home screen with two configured Docker instances:
If you are interested in Portainer, visit my “Portainer Setup” post to see the configuration parameters for your QNAP device.