Oficial Docker Container Topic is solved

Subforum for general discussions. Do not dump your questions/problems here, but try to find the subforum where it belongs!

Moderators: leecollings, remb0

User avatar
heggink
Posts: 972
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Oficial Docker Container

Post 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)
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
User avatar
heggink
Posts: 972
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Oficial Docker Container

Post 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.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
DAVIZINHO
Posts: 234
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Spain
Contact:

Re: Oficial Docker Container

Post 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 :-)
User avatar
heggink
Posts: 972
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Oficial Docker Container

Post 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.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
DAVIZINHO
Posts: 234
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Spain
Contact:

Re: Oficial Docker Container

Post by DAVIZINHO »

And its posible to Restart the container with a comand inside the container?
Not outside, i need inside :-(
User avatar
heggink
Posts: 972
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Oficial Docker Container

Post 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).
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
DAVIZINHO
Posts: 234
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Spain
Contact:

Re: Oficial Docker Container

Post 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
MacJL
Posts: 51
Joined: Tuesday 22 April 2014 22:17
Target OS: OS X
Domoticz version: Beta
Location: France
Contact:

Re: Oficial Docker Container

Post 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
DAVIZINHO
Posts: 234
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Spain
Contact:

Re: Oficial Docker Container

Post 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!!!!
Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

Re: Oficial Docker Container

Post 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
jackslayter
Posts: 59
Joined: Tuesday 07 October 2014 11:00
Target OS: Raspberry Pi / ODroid
Domoticz version: stable
Location: France RA
Contact:

Re: Oficial Docker Container

Post 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
RPi2 + RFLink, Domoticz
Chacon - micromodule 200w, remote 3b, 2x module 1000w, remote 16b, smoke detector, door contact, 2x 3500w plug
Oregon - 3x Thgr122Nx / OWL - CM180 / TRC02_2 RGB / Cheap - PiR, door contact, Temp Hum / 4x REVOLT NC5461
ChrisH
Posts: 4
Joined: Saturday 19 May 2018 20:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Oficial Docker Container

Post 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:
hugoleij
Posts: 2
Joined: Monday 09 January 2023 22:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Oficial Docker Container

Post 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?
Gravityz
Posts: 583
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Oficial Docker Container

Post 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
Gravityz
Posts: 583
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Oficial Docker Container

Post 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
mgugu
Posts: 208
Joined: Friday 04 November 2016 12:33
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France
Contact:

Re: Oficial Docker Container

Post by mgugu »

Docker simplifies life :roll:
Gravityz
Posts: 583
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Oficial Docker Container

Post 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.
MacJL
Posts: 51
Joined: Tuesday 22 April 2014 22:17
Target OS: OS X
Domoticz version: Beta
Location: France
Contact:

Re: Oficial Docker Container

Post 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
 
aukesp
Posts: 14
Joined: Wednesday 24 December 2014 21:16
Target OS: Linux
Domoticz version: 2202.2
Location: Netherlands
Contact:

Re: Oficial Docker Container

Post 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?
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Oficial Docker Container

Post 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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest