Docker is a software platform that allows you to run applications in software containers on Linux (Docker runs like a daemon).

Each software container will have its own environment, which simplifies testing and deployment.

Here is the advantage of containers over virtualization: some parties access the "host" server directly (while virtualization creates a "complete" layer of abstraction).

There are many additional tools that complement Docker to manage redundancy, scalability, etc.

As part of the development of an application, Docker makes it possible to isolate each module (the database, the Web server dedicated to Webservices and the Web server dedicated to sites). These different modules can thus be run on the same server while being isolated from each other.

It is also possible to test a container and then implement it under identical conditions.

Notes:

Docker is also available for Windows.

This purpose of this help page is not to explain how Docker works. However, to use the Docker container that contains the HFSQL server, it is necessary to be familiar with Docker and, in particular:

know how to install a new container from the Docker image of the HFSQL server,

know how to manage at least one volume required for data persistence,

know how to manage the network configuration inside Docker.

Database and Docker: persistence

In its early days, Docker was designed to run "stateless" applications, i.e. without persistent data (data is only temporary and deleted when the container stops). This operating mode would not be very useful for a database.

Since then, Docker has evolved and allows the use of data volumes that are associated with a container (Docker Volume). The data can then be:

in a local volume at the Docker host,

in a volume on SAN/NAS.

Therefore, it is possible to use an HFSQL database in a Docker container while respecting this division. This keeps the advantage of being able to change the HFSQL container (update, etc.) while keeping the data.

Step-by-step setup

Remark: in the following paragraphs, the command lines that illustrate operations on Linux are usable in Ubuntu.

1. Install Docker

First step, the easiest one: installing Docker on the host server.

sudo apt install docker.io

Caution: the name of the application is "docker.io", not "docker" alone.

Remark: This temporary deactivation may be necessary to avoid an error when launching the Docker container (causes the error: "Error response from daemon: driver failed programming external connectivity on endpoint HFSQL_DOCKER").

3. Create a local volume (directory on the host)

In order for the data in the database files to be persistent (you want to keep them), it is preferable not to store these files in the container. To do this, a folder is created (or a mount for a SAN/NAS) on the host. In the example below, the folder is created directly on the host's storage.

Important: in this example of command line, all rights are given on the directory. It is strongly recommended to restrict the rights of the user running the daemon docker as much as possible.

4. Create and execute HFSQL container

At this stage, the daemon docker is installed and the storage volume is created but HFSQL has not yet been installed.

It is actually Docker that will "install" it from its repository site: you just have to indicate to Docker the version to install (all the available versions are available in the "Build Details" tab of the "windev/hfsql" repository on "hub.docker.com".

4.a. Setup "for test"

For testing purposes, it is possible to use the "create" and "start" commands (the command line below has line breaks for more readability).