Tutorial: Launch a test Docker image

Sometimes a developer wants to post a “test” Docker image on the forum to allow users to test a new integration before it is deployed to production.

Unlike the “official” Docker image which is hosted on the gladysassistant/gladys project account, a test image will be hosted on the Docker account of the developer proposing the image. Example: jeanfrancois/gladys.

To launch a test Docker image, it’s the same process as described on the Gladys installation page via Docker: Docker | Gladys Assistant.

The only difference is that you have to change the name of the image in the docker run to the test image, and modify certain parameters of the command.

Before you begin

If you don’t know what you’re doing, avoid running a test image on the same machine as your production installation, as this could have consequences on your installation!

Launch test image

Let’s imagine that we want to launch a test image of the “zwave” integration, developed by “jeanfrancois”.

We will take the docker run command on the Gladys site, and modify several things:

  • The name of the container, for example “gladys-zwave-test” instead of “gladys”: --name gladys-zwave-test \
  • The port on which Gladys runs, for example 8001 instead of 80: -e SERVER_PORT=8001 \
  • The folder in which all Gladys files will be saved (database, configuration): -v /var/lib/gladysassistant_zwave_test:/var/lib/gladysassistant \
  • The name of the Docker image to launch: jeanfrancois/gladys instead of gladysassistant/gladys

Which gives us this command:

docker run -d \
--log-driver json-file \
--log-opt max-size=10m \
--cgroupns=host \
--restart=always\
--privileged\
--network=host \
--name gladys-zwave-test \
-e NODE_ENV=production \
-e SERVER_PORT=8001 \
-e TZ=Europe/Paris \
-e SQLITE_FILE_PATH=/var/lib/gladysassistant/gladys-production.db \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/lib/gladysassistant_zwave_test:/var/lib/gladysassistant \
-v /dev:/dev \
-v /run/udev:/run/udev:ro \
jeanfrancois/gladys

To access Gladys:

http://IP_MACHINE:8001

To stop this container:

docker stop gladys-zwave-test

To delete this container:

docker rm gladys-zwave-test

To fetch a new version of the image

(if the dev has made progress on its integration):

docker pull jeanfrancois/gladys

Please note that a Docker container is immutable: if you ever pull a new image, you must stop the container, delete the container then docker run a new container :slight_smile:

Note:

Avoid connecting your Gladys Plus account to a test instance, as this will disconnect your production instance.

2 Likes