Page 8 of 11

Re: Oficial Docker Container

Posted: Thursday 04 August 2022 13:16
by heggink
That's because the docker container does not run domoticz as a service but just starts the process.

if you want to check the process, you have to install procps (apt update && apr install -y procps) and then see if the process runs (ps ax|grep domoticz)

Re: Oficial Docker Container

Posted: Thursday 04 August 2022 13:19
by heggink
if it helps, I run a simple dzvents script that prints a message in the domoticz log every minute:

Code: Select all

--
-- this script logs a message every minute
--
return {
        active = true,
        on = { timer = { 'every minute' } },
        execute = function(dz,item)
                print('Domoticz alive')
        end
}
That way, I can easily spot when things lock up or crash. I have most of my logging off since things are quite stable.

Re: Oficial Docker Container

Posted: Thursday 04 August 2022 13:19
by DAVIZINHO
heggink wrote: Thursday 04 August 2022 13:16 That's because the docker container does not run domoticz as a service but just starts the process.

if you want to check the process, you have to install procps (apt update && apr install -y procps) and then see if the process runs (ps ax|grep domoticz)
thanks for the info!!

and exist a method to restart the process, from a script inside the docker? or restart the docker?

I use a init.sh each time i update the docker image and after this execution i stop the container and start again. A comand at the end of the script that restar the docker or de domoticz process, will be perfect for me :-)

Re: Oficial Docker Container

Posted: Thursday 04 August 2022 14:33
by heggink
The 'normal' way is to restart the container...
A container is not a substitute for a virtual machine so you mormally restart the container instead of restarting processes within the container.

Re: Oficial Docker Container

Posted: Thursday 04 August 2022 14:49
by DAVIZINHO
And its posible to Restart the container with a comand inside the container?
Not outside, i need inside :-(

Re: Oficial Docker Container

Posted: Thursday 04 August 2022 16:27
by heggink
I am not an expert but, AFAICT, this is not possible.
You would need to build a workaround where, from whitin the container, you flag a restart (touch some filename of a file mapped into the container e.g. "restart_me" and then a cron type entry that checks for the file, deletes it and restarts the container).

Re: Oficial Docker Container

Posted: Thursday 04 August 2022 16:38
by DAVIZINHO
heggink wrote: Thursday 04 August 2022 16:27 I am not an expert but, AFAICT, this is not possible.
You would need to build a workaround where, from whitin the container, you flag a restart (touch some filename of a file mapped into the container e.g. "restart_me" and then a cron type entry that checks for the file, deletes it and restarts the container).
or maybe other workaround, but its a stupid idea... is make something that get a fatal error to the container and its reboot itself, because the autoreboot of the container is active.
This is a bad idea, i know. hahaha, but maybe its will be easy

Re: Oficial Docker Container

Posted: Thursday 04 August 2022 16:38
by MacJL
DAVIZINHO wrote: Thursday 04 August 2022 14:49 And its posible to Restart the container with a comand inside the container?
Not outside, i need inside :-(
Just kill the main process launched by the container. Depending its restart policy, it will restart just after that.

UPDATE : With docker, to set a restart poilcy that always restart the container when it exits, the command should be :

Code: Select all

docker container update --restart always your_container_name

Re: Oficial Docker Container

Posted: Thursday 04 August 2022 16:52
by DAVIZINHO
MacJL wrote: Thursday 04 August 2022 16:38
DAVIZINHO wrote: Thursday 04 August 2022 14:49 And its posible to Restart the container with a comand inside the container?
Not outside, i need inside :-(
Just kill the main process launched by the container. Depending its restart policy, it will restart just after that.

UPDATE : With docker, to set a restart poilcy that always restart the container when it exits, the command should be :

Code: Select all

docker container update --restart always your_container_name
hahaha. it works.

in synology the autorestart is a checkbox, easy
i run a "pidof domoticz" and it returns 1
after this i run "kill 1" and the container stop, and then the container automatically on again
this is a bad solution, but perfect for my pourpose!!!!

Re: Oficial Docker Container

Posted: Tuesday 23 August 2022 2:41
by Gianni
running domoticz Version: 2022.1 (build 14453) on docker with host ubuntu server 22.04
I have 2 questions.
I see that this image running python 3.7.3 but i cannot update the python version inside the container.
I installed deadsnake ppa and update to v 3.11 but that did not work.

2
I mnt my local folder to /opt/domoticz/userdata
This works perfect but when i install a plugin with pp manager it's instal the plugin to /opt/domoticz/plugins.
So i need to manually move the plugin every time i create one
How can i fix this problem?
---------------------------------------------------------------------------------------------------------------------
First problem fixed
Python Version: 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]

I just build my docker image self based on bullseye.
Looking out for ssl3 support so i can use bookworm with python3.10

Re: Oficial Docker Container

Posted: Wednesday 21 September 2022 8:35
by jackslayter
Hi,
I will to move Domoticz installation to Docker-compose and Traefik install. Everything works except the IP log which is the internal Docker IP (172.x.x.x) instead of the external IP lan or IP public.
In traefik conf I add "forwardedHeaders" for "trustedIPs" and works fine with other containers (perhaps because they have an option "ip_header": "X-Real-IP" or "trustedReverseProxy=true"

Do you have a command to add this option or it does not exist yet (I use stable Domoticz version "2022.1") ?

Thank you

Re: Oficial Docker Container

Posted: Thursday 22 December 2022 13:20
by ChrisH
I'm trying to get some smartplugs to work with Domoticz. The plugin requires PyP100 python module, which has PyCryptodome as a dependency. Unfortunately installing it with "pip install pycryptodome" results in the following error:

Code: Select all

    error: command 'aarch64-linux-gnu-gcc' failed: No such file or directory: 'aarch64-linux-gnu-gcc'
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_ery8obk/pycryptodome/setup. py';f=getattr(tokenize, 'open', open)(__file__);code=f. read().replace('\r\n', '\n');f. close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-u4h7_7cz/install-record. txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-_ery8obk/pycryptodome/
Is there anyway to get 'aarch64-linux-gnu-gcc' in the container? Or is there a workaround to get pycryptodome installed?

Why is this stupid forum software complaining about external url's in the code... just because there's a . between 2 characters... :roll:

Re: Oficial Docker Container

Posted: Wednesday 11 January 2023 11:49
by hugoleij
Hi,

I want to mount Config/manufacturer_specific (dot) xml so i can edit the file. I try the following but the Config folder in the container and outside the container is empty.

Code: Select all

  volumes:
      - ./config/userdata:/opt/domoticz/userdata
      - ./config/Config:/opt/domoticz/Config
 
Can someone help me?

Re: Oficial Docker Container

Posted: Wednesday 11 January 2023 15:13
by Gravityz
i do not think you can map 2 different subdirectories in the container to the same path(./config)

also it is better to define absolute paths so you see where things are mapped

please note you are mapping EXTERNAL directories to INTERNAL directories
so when you look in the internal directory you see the external data, not the other way around

in your case you are mapping external directory ./config/Config(which is empty) to the internal directory which was not empty but now is

Re: Oficial Docker Container

Posted: Wednesday 11 January 2023 15:23
by Gravityz
to solve your problem

login the container
cp -r /opt/domoticz/Config /opt/domoticz/userdata (the internal directory Config is copied to external directory ./config/userdata

edit the config files externally with eg winscp
go into the container again and copy the modieid file back.

cp -u /opt/domoticz/userdata/Config/file /opt/domoticz/Config

Re: Oficial Docker Container

Posted: Wednesday 11 January 2023 15:34
by mgugu
Docker simplifies life :roll:

Re: Oficial Docker Container

Posted: Wednesday 11 January 2023 16:31
by Gravityz
mgugu wrote: Wednesday 11 January 2023 15:34 Docker simplifies life :roll:
as long as you stay inside the container.

whenever you want to do simple things like share files between containers or execute commands from one container into another container then life gets really complex.

Re: Oficial Docker Container

Posted: Wednesday 11 January 2023 18:18
by MacJL
hugoleij wrote: Wednesday 11 January 2023 11:49 Hi,

I want to mount Config/manufacturer_specific (dot) xml so i can edit the file. I try the following but the Config folder in the container and outside the container is empty.

Code: Select all

  volumes:
      - ./config/userdata:/opt/domoticz/userdata
      - ./config/Config:/opt/domoticz/Config
 
Can someone help me?
Hello

Copy the file locally :

Code: Select all

docker cp your_container_name:/opt/domotic/Config/xxx.xml .
Edit it :

Code: Select all

edit xxx.xml
Present it to your container :

Code: Select all

  volumes:
      - ./config/userdata:/opt/domoticz/userdata
      - ./xxx.xml:/opt/domoticz/Config/xxx.xml
 

Re: Oficial Docker Container

Posted: Thursday 12 January 2023 16:12
by aukesp
I try also to use Domoticz on a Docker container and migrate to zwave-JS on a Windows machine with Docker instelled.
Everything is going fine but....
My USB devices are not seen/ connected.
In all packages the note: Like the other methods replace /dev/serial/by-id/insert_stick_reference_here with the serial device for your Z-Wave stick.
Where ever I look i do not find any serial/ USB device.
Also the command: lsusb is not found??
ls -l /dev/ttyUSB0 gives no result.

Where am I going wrong or have I missed something?

Re: Oficial Docker Container

Posted: Thursday 12 January 2023 18:40
by waltervl
It seems that docker on windows with USB access difficult to install, google on WSL Better to install Ubuntu on your system and use that.