How to configure and deploy custom app templates in Container Station 3?
Container Station app templates let you deploy preconfigured containers to your QNAP environment. By default, Container Station provides a collection of QNAP-Verified Templates, but you can add additional custom app templates to meet your specific needs. You can host these custom app templates directly on your QNAP device or on an external web server.
This tutorial explains two methods of hosting custom app templates on your QNAP device, and how to configure Container station to access these custom app templates.
- Creating a Custom App Template File
- Hosting a Custom App Template in an NGINX Container
- Hosting a Custom App Template with the QNAP Web Server
- Adding a Custom App Template to Container Station
- Deploying a Custom App Template
Creating a Custom App Template File
The first step is to create a custom app template file. By default, Container Station provides a list of containers that are verified to work correctly with your QNAP device. You can download and modify QNAP-Verified Templates here, or create a new file yourself.
You can modify the template file within any text editor.
App Template Format
App template definitions are written in JSON. Valid templates consist of an array, and one or more container template elements. Each container template element is a JSON object that includes any mandatory or optional data fields. The format should be similar to the following example:
{
"templates": [
{
// template1
},
{
// template2
},
...
]
}
JSON Element Format
type
|
Attribute |
Description |
|---|---|
|
Description |
The type of container (Docker or LXD) for this template. |
|
Importance |
Required |
|
Format |
Integer |
|
Accepted Values |
|
title
|
Attribute |
Description |
|---|---|
|
Description |
The title of the template. |
|
Importance |
Required |
|
Format |
String |
|
Accepted Values |
Any string value |
sub_title
|
Attribute |
Description |
|---|---|
|
Description |
Information about the template version. |
|
Importance |
Required |
|
Format |
String |
|
Accepted Values |
Any string value |
description
|
Attribute |
Description |
|---|---|
|
Description |
A description used to provide information about the template. |
|
Importance |
Required |
|
Format |
String |
|
Accepted Values |
Any string value |
logo
|
Attribute |
Description |
|---|---|
|
Description |
The location of a logo for the template. |
|
Importance |
Optional |
|
Format |
String |
|
Accepted Values |
Any valid URL or path relative to the network domain where the custom app template is hosted. |
location
|
Attribute |
Description |
|---|---|
|
Description |
The template URL. Could be an introduction webpage for the template. |
|
Importance |
Optional |
|
Format |
String |
|
Accepted Values |
Any valid URL |
platform
|
Attribute |
Description |
|---|---|
|
Description |
The supported platform. Must contain a valid value. |
|
Importance |
Required |
|
Format |
String |
|
Accepted Values |
|
|
Example |
|
image
|
Attribute |
Description |
|---|---|
|
Description |
The image associated with a template. |
|
Importance |
Required |
|
Format |
String |
|
Accepted Values |
Any valid image |
|
Example |
|
command
|
Attribute |
Description |
|---|---|
|
Description |
The command to run in the Docker container. If unspecified, the container uses the default command specified in the Dockerfile. |
|
Importance |
Optional |
|
Format |
String |
|
Accepted Values |
Any string value |
|
Example |
|
entrypoint
|
Attribute |
Description |
|---|---|
|
Description |
The entrypoint to start the Docker container. If unspecified, the container uses the default entrypoint specified in the Dockerfile. |
|
Importance |
Optional |
|
Format |
String |
|
Accepted Values |
Any string value |
|
Example |
|
env
|
Attribute |
Description |
|---|---|
|
Description |
A JSON array describing the environment variables required by a template. Each element in the array must be a valid JSON object. |
|
Importance |
Optional |
|
Format |
Array |
|
Accepted Values |
A valid JSON array |
|
Array Format |
|
|
Example |
|
labels
|
Attribute |
Description |
|---|---|
|
Description |
A JSON array describing the labels associated with a template. Each element in the array must be a valid JSON object. |
|
Importance |
Optional |
|
Format |
Array |
|
Accepted Values |
A valid JSON array |
|
Array Format |
|
|
Example |
|
volumes
|
Attribute |
Description |
|---|---|
|
Description |
A JSON array describing the volumes associated with a template. Each element in the array must be a valid JSON object with a required container property. |
|
Importance |
Optional |
|
Format |
Array |
|
Accepted Values |
A valid JSON array |
|
Array Format |
|
|
Example |
|
ports
|
Attribute |
Description |
|---|---|
|
Description |
A JSON array describing the ports exposed by a template. Each element in the array must be a valid JSON string specifying the port number in the container, as well as the protocol. This can optionally be prefixed with a port number and colon (for example 8080:) to define the port being mapped on the host. If the host port is not specified, the Docker host automatically assigns a port when the container starts. |
|
Importance |
Optional |
|
Format |
Array |
|
Accepted Values |
A valid JSON array |
|
Example |
|
hostname
|
Attribute |
Description |
|---|---|
|
Description |
The hostname of the container. Can help to easily identify the container. |
|
Importance |
Optional |
|
Format |
String |
|
Accepted Values |
Any string value |
|
Example |
|
restart_policy
|
Attribute |
Description |
|---|---|
|
Description |
The restart policy associated with the Docker container. If unspecified, this value defaults to unless-stopped. |
|
Importance |
Optional |
|
Format |
String |
|
Accepted Values |
|
|
Example |
|
auto_start_policy
|
Attribute |
Description |
|---|---|
|
Description |
The auto start policy associated with the LXD container. If unspecified, this value defaults to retain. |
|
Importance |
Optional |
|
Format |
String |
|
Accepted Values |
|
|
Example |
|
interactive
|
Attribute |
Description |
|---|---|
|
Description |
Controls whether the Docker container should start in foreground mode. If unspecified, the value defaults to true. |
|
Importance |
Optional |
|
Format |
Boolean |
|
Accepted Values |
|
|
Example |
|
tty
|
Attribute |
Description |
|---|---|
|
Description |
Controls whether the Docker container should be allocated a pseudo-TTY. If unspecified, defaults to true. |
|
Importance |
Optional |
|
Format |
Boolean |
|
Accepted Values |
|
|
Example |
|
privileged
|
Attribute |
Description |
|---|---|
|
Description |
Controls whether the container should start in privileged mode. If unspecified, defaults to false. |
|
Importance |
Optional |
|
Format |
Boolean |
|
Accepted Values |
|
|
Example |
|
Hosting a Custom App Template in an NGINX Container
Next, you'll need to make the custom app template available to Container Station. This topic explains the process of hosting the template file with an NGINX container also running in Container Station.
Alternatively, you can also host the app template file in the QNAP Web Server. See Hosting a Custom App Template with the QNAP Web Server.
After you update the custom app templates JSON file, you must restart the NGINX container for the changes to reflect within the container.
The app template file becomes available for use.
You can verify that the app template file is accessible by entering http://HOST_IP_ADDRESS:PUBLISHED_HOST_PORT/TEMPLATE_FILENAME in the web browser. For example: http://192.168.1.1:30080/my-templates.json.
Hosting a Custom App Template with the QNAP Web Server
Next, you'll need to make the custom app template available to Container Station. This topic explains the process of hosting the template file with the QNAP Web Server.
Alternatively, you can also host the app template file with an NGINX container directly within Container Station. See Hosting a Custom App Template in an NGINX Container.
- Enable the QTS Web Server.
- Upload the custom app template file.
The app template file becomes available for use.
You can verify that the app template file is accessible by entering http://HOST_IP_ADDRESS:WEB_SERVER_PORT/TEMPLATE_FILENAME in the web browser. For example: http://192.168.1.1:80/my-templates.json.
Adding a Custom App Template to Container Station
The next step is to add the custom app template file to Container Station. This makes the list of applications apps available within Container Station.
Container Station saves the custom app template.
Deploying a Custom App Template
The final step is to deploy a container from the custom app template file you added in the previous step.
The Deploy Container wizard opens. See Creating a Docker Container.



.



