Docker

Domotz Agent Installation on Docker (Linux only)

Pull the image by performing this command:

docker pull domotz/domotzpro-agent-amd64

Run and Configure (Linux only)

Start the Docker container as a background service:

docker run --network=host --cap-add NET_ADMIN --publish 3000:3000 -d domotz/domotzpro-agent-amd64

Once the Domotz Agent has been started in the Docker Container connect to the host IP on port 3000 and follow the instruction to configure the Domotz Agent. E.g.

http://172.16.10.155:3000

(assuming 172.16.10.155 the IP of the Host)

For Mac and Windows platforms see the notes.

Important Notes

To ensure that the Domotz Agent restarts with the same configuration even if you destroy the environment and rebuild the container, we recommend that the configuration of the Domotz Agent is written on a file on the local storage.

To do this please:

  1. create a persistent directory for your Domotz agent on your host with a config directory in it:mkdir -p /absolute_path_to_your_local_domotz_directory/config/
  2. create an empty domotz.json file on your server’s local file system:touch /absolute_path_to_your_local_domotz_directory/config/domotz.json

(n.b. the persistent directory and the config directory must be created too)

  1. mount the Domotz configuration file as an external volume (on the host server):/opt/domotz/etc/domotz.json

You can run the docker container with this option:

--mount type=bind,source=/absolute_path_to_your_local_domotz_directory/config/domotz.json,target=/opt/domotz/etc/domotz.json

If you use docker compose do this by adding this line into your .yml file under the “volumes:” directive (line):

- /path_local_domotz_dir/config/domotz.json:/opt/domotz/etc/domotz.json

you can find an example here:

version: "3.9"
services:
  image: domotz/domotzpro-agent-amd64
  network_mode: "host"
  container_name: domotz
  ports:
   - "3000:3000"
  volumes:
   - /home/domotz/docker/domotz/config/domotz.json:/opt/domotz/etc/domotz.json
  environment:
   - HOST:0.0.0.0
  cap_add:
   - NET_ADMIN
  restart: unless-stopped

Alternatively, you can force the Docker Container to start always with the same MAC address (e.g. “docker run … –mac-address 02:42:AC:12:00:03 …”). In this way, when the Domotz Agent restart, and you will be required to re-configure it with your account, you will not been asked to create a new entity, but you will be allowed to RESUME the configuration from the previous Domotz Agent.

Setting the mac-address is not compatible with –network=host. Using host networking uses the mac address of the host so destroying and re-creating a container on the same host should link properly.

Please note

On Mac and Windows platforms the container is not able to discover devices and monitor them on the hosting network. However, you can monitor the Docker Daemon network and the other containers running on that.

To launch the container and start monitoring your Docker network you can simply type:

docker run --publish 3000:3000 -d domotz/domotzpro-agent-amd64

Please check also our docker hub page: https://hub.docker.com/r/domotz/domotzpro-agent-amd64

Updated on September 28, 2022

Was this article helpful?