Docker setup

Docker is an alternative to the classic environment setup ( see Set up your local IDE )

It enables you to install and run your project in isolation from the rest of the system which provides the advantage of removing system dependencies and conflicts.

Isolation is achieved by creating a lightweight container (Docker Container) which behaves like a virtual machine (in our case Ubuntu Linux).

Install Prerequisities

In order to use the Quix SDK in Docker you need to have installed these prerequisities.

  • Docker (tested on version 19.03.6)

  • docker-compose (tested on version 1.23.1)

Install Docker ( step 1 )

To install the Docker on your environment you need to follow this guide here (https://docs.docker.com/get-docker/).

On Windows we tested this setup using the WSL2 backend.

Install docker-compose ( step 2 )

We’ll be using the docker-compose tool which is designed for easy configuration of local Docker setups.

To install docker-compose, please follow the guide here ( https://docs.docker.com/compose/install/ ).

If you are on Windows then you can skip this step because the Docker installation package from the step 1 already contains the docker-compose tool.

Start with downloading your project

We have created full support for Docker in all of our Python projects. Just simply download the project then follow the steps below from inside the 'source' subfolder.

Build and run project

Once you have downloaded the project folder then you can execute following commands in your command line. Be sure to be in the projects 'source' subfolder.

docker-compose up --build

On the first run the compile script may take while (around 10 minutes) to build all the project dependencies. The subsiquent builds will be much faster.

Running as a daemon in the background

If you want to run the application as a daemon in the background, you can use this command to start the application:

docker-compose stop && docker-compose up --build -d

After running the script the application is running in the background. To access the application console output you can run the following command:

docker-compose logs -f

Then once you no longer need the application to be running you can stop it using this command:

docker-compose stop

Accessing the Docker bash ( e.g. for installation of additional python packages )

Due to the container nature of Docker, the application is running in an isolated environment ( Docker container ). If you want to access the bash of the Docker container you need to go via the docker-compose command:

docker-compose exec server bash

To access the bash command you need to have the container running. This can be either in the separate window or as daemon.

Once you are in you can simply install the python packages as you are used to ( e.g. pip install YOUR_PACKAGE or pip freeze -r requirements.txt ).

Any changes which you make inside the Docker container are only temporary and will be erased with the next build. In order to make these changes permanent you need to modify the source/docker/Dockerfile file.

Additional documentation

To get the additional information on Docker and Docker compose commands please follow up with the documentation: