Installing bliss in a QNAP Docker container
After three years of waiting for a bliss QNAP package, two turn up at once!
Hot on the heels of Grant Shipley's pre-prepared Docker container, Sean Gordon has written up step-by-step instructions for installing bliss in a Docker container.
Over to you, Sean!
Installing Bliss on a QNAP NAS using the Docker and the Container Station
To create Docker containers on a QNAP NAS, you must have the Container Station application installed. Container Station is available from the QTS App Center (QTS 4.2 or above) for these x86-based devices:
... and also the ARM-based TS-x31+ series with a minimum of 1GB RAM.
These Docker build instructions are completely generic and should work on any system which supports Docker.
An introduction to Docker/container terminology
Containers are a light-weight virtualisation technology, rather than installing a complete OS image as one does with host virtualisation, containers run on top of the host operating system in an isolated environment created by the Docker Engine.
With Docker we need to be familiar with two concepts; images – the pre-configured software image from which we create the container, and the container – the actual execution environment where the program runs. For the bliss install, we’ll first create a Docker image which contains the latest version of bliss and all its dependencies, and then we’ll use this image to create the container which will run bliss on the QNAP.
Docker build steps
To kick-off the container image build process we need to login to the QNAP NAS - connect to your QNAP NAS using SSH (this needs to be enabled in the QTS Control Panel, under the Network Services section).
Once you have logged on, run the following commands to build the bliss container image
cd /share/Public/docker docker build --rm=true --tag="bliss-image" .
This will take a while to complete as it downloads the Ubuntu Trusty image and installs the various components into the container image. Once the build is complete you will see a message like this:
Removing intermediate container 99af97f56a24 Successfully built 272f8cba8682
Your numbers will be different as these are unique container IDs which are automatically generated by the installation process.
At this point, we can log off QNAP SSH session and move to the QNAP UI for all the other build steps. In the QNAP UI open Container Station and you’ll now see two new images available under the Create Container option:
- ubuntu – this is the Ubuntu Trusty image which our bliss image is based on.
- bliss-image – this is the pre-installed image for bliss from which we will build the actual container.
So far we have only created the image for the bliss container, next we need to create the actual container which will host the running instance of bliss.
Next click Create on the bliss-image. This will open the “Create Container” dialog:
- Set the name to bliss
- Set CPU limit to 50%
- Set Memory Limit to 2048MB (or what ever is appropriate for your NAS - this simply sets the maximum amount of memory the Container is allowed to use, it does not exclusively allocate this memory to the Container. You can change this value and the CPU limit later if needed.)
Note: Because we are running bliss in a container we need to wrap the standard
bliss.sh script in another script which will restart
bliss.sh after an update. This is because containers are cleaned up when the process they are running terminates, so if we just started
bliss.sh then the container would automatically terminate when bliss exited during the update process. As a result, we need to create a wrapper script called
bliss-runnner.sh which will restart
bliss.sh if it exits with a zero return code (as happens during an update). If
bliss.sh exits with a non-zero return code (indicating an error) then the runner script exits to ensure we don’t get into an endless loop of fail and restart.
Now click Advanced Settings. Under Environment, add a variable with the name
VMARGS and set its value to
-Dbliss_working_directory=/config. This controls where bliss stores its working files:
Now on the Network tab, set the Hostname to "bliss" and set the Port Forwarding to match the 3220 & 3221 ports exposed by the bliss container.
On the Storage tab, check that New Volume is set to
/config, this is a mount within the container where bliss will store working files and configuration information.
Now, finally, under Volume from host you need to map the location of your music library on the QNAP to the
/Music mount point inside the container. In my example my music is stored in the
/Music share on the QNAP, so my mapping is
/Music. This mapping must be Read and Write to enable bliss to update the album art:
Now click the Create button to create the bliss container.
Once the create process completes, you will see a new container listed in the Container Station UI:
Text in the Console window will say something like:
bliss will also echo any error messages to this console window – the best way to check bliss is running is to point your browser at
http://<your-QNAP-ip>:3220 and configure bliss as normal.
You should not need this, but I have included it for the curious...
Once the container is up and running, bliss is running in the isolated Linux container in much the same way as it would be if you installed it directly on Linux. However, there is one difference when it comes to “logging in” to the container environment if you want to debug or access the command line for the container.
First you need to find the ID of the running container. To do this, connect to you QNAP via SSH and run the following command:
You’ll now see something like this:
CONTAINER ID IMAGE ... NAMES 2b7868288ae9 bliss-image:latest ... bliss
We are interested in the CONTAINER ID running Bliss – in this case 2b7868288ae9 (your ID will be different). To access the shell within this container we need to tell docker to execute a shell within the running container using the ID you saw from the
docker ps command:
docker exec -i -t <your CONTAINER ID> bash
docker exec -i -t 2b7868288ae9 bash
You’ll then see a prompt like this:
And at this point you are logged into the shell within the running container, which will function just like a normal Linux shell. When you are done, simply exit the shell.
Thanks Sean! Although this method requires a certain technical know-how to get started, I think the instructions are actually pretty straightforward and familiar to anyone who has set up any kind of virtualisation!