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

Post Reply
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 »

ahh, jeje. ok. no problem!

probable the people that use docker, know that if you change the name of the image you can use the diferent tags available in docker hub. so not problem
but your are right, if its documented, better!
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Oficial Docker Container

Post by EddyG »

waltervl wrote: Thursday 14 October 2021 21:16 As the developer of the new tags is not documenting it I hope someone here knows how to use this :-)
This is the way (almost) everybody uses the hub. There are 4 tags, and to me it is obvious which is what by the name of the tag.
But you need to keep in mind that if you are on the latest (beta) and want to go back to a stable the database might not be of the same version.
If you know what you are doing then you save images locally and use them.
Domoticz in docker is not the holy grail.
Currently latest docker image is build 13703
You could also use the image from linuxserver/domoticz they preserve a lot more.
vodor
Posts: 39
Joined: Friday 19 February 2016 14:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Oficial Docker Container

Post by vodor »

Since moving over most of my switches to sonoff and shelly there are no more dependency on my RazBerry Zwave on the GPIO of the RPI so I decided to give docker a try. Everything works great I have my pi that mounts my /opt/domoticz/userdata to a NFS share. In addition I added another external volume with my own scripts on as /opt/domoticz/scripts
Everything works fine except my scripts does not execute. I keep on getting a permission denied.
Initially I though it was the NFS squash user setting but my NAS is set to squash no users. I tried the other values just to confirm and when I set squash all or squash root then I cannot write to the domoticz database.

When I connect directly to the docker and execute the scripts as follows from the script folder I get permission denied.
"root@1c633c24293e:/opt/domoticz/scripts# ./cam_emailalerts-off.sh
bash: ./cam_emailalerts-off.sh: Permission denied"

When I run it with a sh infront of the command it runs.
"root@1c633c24293e:/opt/domoticz/scripts# sh cam_emailalerts-off.sh
[
{
"cmd" : "SetEmail",
"code" : 0,
"value" : {
"rspCode" : 200
}
"

My shell script is pretty basic. It has she sheban inside with a curl command and the script is set to executable.
"#!/usr/bin/sh

curl -sk -H "Content-Type: application/json" -X POST "http://192.168.128.195/cgi-bin/api.cgi? ... $APITOKEN1""

Any ideas?

UPDATE: After going through all my settings again on the NAS and the Host mounting the NFS I found my mistake. I mounted the NFS share with noexec and failed to notice that the first 325 times I looked at the mount. Removed it and now my scripts execute fine. ;-)
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 »

antonlamers wrote: Wednesday 06 October 2021 12:14 Hi
Yesterday I did update the container.
Now is the screen view from everyting wrong

Version: 2021.1 (build 13689)
Build Hash: d29a27ffe
Compile Date: 2021-10-05 08:15:57
dzVents Version: 3.1.8
Python Version: 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]
i still having this problem
do you solve it?
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 »

There is an issue with custom templates Machinon and Aurora in beta releases. Do you use one of these?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
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 »

waltervl wrote: Friday 29 October 2021 14:44 There is an issue with custom templates Machinon and Aurora in beta releases. Do you use one of these?
nop. i use default theme :-(
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 »

Then clear browser cache (as usual after each update).
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
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 »

waltervl wrote: Friday 29 October 2021 19:03 Then clear browser cache (as usual after each update).
As usual, and still the same problem. Not a cache problem. Do you use docker and not have the problem?
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 »

No, I do not, but I know a lot of developers use docker so I would suspect an incorrect UI would be noticed.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Oficial Docker Container

Post by EddyG »

I use dockers on several Raspberries and Synology and I don't have that problem.
Try, delete the old image and get the latest, and try again.
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 »

wow!. i dont know which is the problem. I clean cache in chrome, I delete de image and get the latest, and the problem persist. I dont know which is the problem :-(

but if you dont have any problem, i will check more things and try to understand with is the problem.
thanks!
User avatar
laco
Posts: 86
Joined: Tuesday 30 October 2018 12:57
Target OS: NAS (Synology & others)
Domoticz version: 2021.1
Location: Slovensko
Contact:

Re: Oficial Docker Container

Post by laco »

I want to ask if anyone has experience.
I used dzvents script to record temperature and humidity values to mysql database in Synology. It worked without problems when the domoticz package was installed in Synology.
When I switched to DOCKER with the domoticz program, this script no longer writes values to the SQL database in Synology.
Now in Synology I have a MariaDB 10 database on port 3006

Is there any way it can be done to write it down again?

Here is my original script:

Code: Select all

local scriptVersion = '0.201909201700' 
local scriptVar  =  'TMEP_' .. scriptVersion

--[[ 

This dzVents script is used to send temperature and humidity data to a TMEP database 
see  https://github.com/MultiTricker/TMEP for details on how to use and setup.

The script use os.popen to trigger a mySQL insert statement 
It also tested and works for a remote system if the system with the TMEP database 
can be accessed by the user that is running the domoticz service, via password-less 
SSH (with public / private key setup)

Be aware that even if domoticz runs as root it will not behave the same 
as from the command line because it can use a different OS environment.
That can imply that if you can access the database from the command line without password
you still need to use that when access from the domoticz program.

Before activating the script:
    Read the GETTING STARTED section of the dzVents wiki. 
    Change the values in the script to reflect your setup, including
    the names / ID s of your humidity and temperature devices.
    
]]--

return
{
    on = 
    { 
         timer = { 'every 1 minutes' },  -- Set to required frequnecy
    },

    logging =   
    {
        level = domoticz.LOG_DEBUG, -- set to LOG_ERROR when tested and OK
        marker = scriptVar,
    },
    
   execute = function(dz)
        
        local db = { 
                        name = 'ipx800',             -- database name
                        user = 'root',           -- change to your database username
                        userPassword = 'mypassword',   -- set userPassword = false (without quotes) when you can access the database without
                        remoteHost = false,        -- set remoteHost = 'remote hostname' when database is remote 
                        sudoRequired = false,      -- set true or false
                        temperatureDevice = 'teplota', -- change to your temperature sensor "name" or idx
                        humidityDevice = 'Slovenská Ves',      -- change to your humidity sensor "name" or idx
        
                        table = 'tme',           -- these table- and fieldnames probably do not need to change 
                        dateTime = 'kdy',
                        temperature = 'teplota',
                        humidity = 'vlhkost',
                    }
        -- =======================================================================
        --               NO changes required below this line
        -- =======================================================================
        local temperature = dz.utils.round(dz.devices(db.temperatureDevice).temperature,1) 
        local humidity = dz.utils.round(dz.devices(db.humidityDevice).humidity,1)    
        --local humidity = 0
        local function osCommand(cmd)
            dz.log('Executing Command: ' .. cmd,dz.LOG_DEBUG)
            
            local fileHandle = assert(io.popen(cmd, 'r'))
            local commandOutput = assert(fileHandle:read('*a'))
            local returnTable = {fileHandle:close()}
            
            dz.log("ReturnCode: " .. returnTable[3] .. "\ncommandOutput:\n" .. commandOutput, dz.LOG_DEBUG)
            
            if returnTable[3] ~= 0 then
                dz.log("ReturnCode: " .. returnTable[3] .. "\ncommandOutput:\n" .. commandOutput, dz.LOG_ERROR)
            end
            
            return commandOutput,returnTable[3] -- rc[3] contains returnCode
        end

        local function buildCommand(temperature, humidity)
            local sshBOL =  ( db.remoteHost and "ssh "  .. db.remoteHost .. " \'" ) or '' 
            local sshEOL =  ( db.remoteHost and ";\'" ) or ';' 
            local password = ( db.userPassword and " -p" .. db.userPassword .. " "  ) or ''
            local sudo = (db.sudoRequired and "sudo " ) or '' 
            
            local cmd = sshBOL .. 
                        sudo .. " echo \" INSERT INTO " .. 
                        db.table .. "(" .. 
                        db.dateTime .. ", " .. 
                        db.temperature .. ", " .. 
                        db.humidity .. ")" .. "VALUES (NOW(), " .. 
                        temperature .. ", " .. 
                        humidity .. ") \" | mysql -v -u " ..
                        db.user .. 
                        password .. " " .. 
                        db.name .. 
                        sshEOL
            return cmd 
        end
        
        osCommand(buildCommand(temperature , humidity))
    end
}
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Oficial Docker Container

Post by EddyG »

Did you try to set the remotehost var to the real internal IP adres of your Synology? And perhaps sudo to true?
User avatar
laco
Posts: 86
Joined: Tuesday 30 October 2018 12:57
Target OS: NAS (Synology & others)
Domoticz version: 2021.1
Location: Slovensko
Contact:

Re: Oficial Docker Container

Post by laco »

Not.
Can you show me how to do it?
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Oficial Docker Container

Post by EddyG »

Code: Select all

                        remoteHost = false,        -- set remoteHost = 'remote hostname' when database is remote 
                        sudoRequired = false,      -- set true or false
On the first line replace false with the ipaddress and on the second line false with true.
User avatar
laco
Posts: 86
Joined: Tuesday 30 October 2018 12:57
Target OS: NAS (Synology & others)
Domoticz version: 2021.1
Location: Slovensko
Contact:

Re: Oficial Docker Container

Post by laco »

I changed, but it doesn't work.

Code: Select all

                        remoteHost = '192.168.1.100:3306',        -- set remoteHost = 'remote hostname' when database is remote 
                        sudoRequired = true,      -- set true or false
log:

Code: Select all

2021-11-07 19:26:00.477 Error: dzVents: Error: (3.1.8) TMEP_0.201909201700: ReturnCode: 127
2021-11-07 19:26:00.477 commandOutput:
2021-11-07 19:26:00.477
tarmacalastair
Posts: 94
Joined: Wednesday 30 October 2019 14:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Great Britain
Contact:

Re: Oficial Docker Container

Post by tarmacalastair »

Hello,

I had this container running successfully a few weeks ago on a Pi running Debian 10 Buster. In the last few days I rebuilt it because I could not get my LUA scripts from my old non-docker version to run so I thought I'd start again from the beginning.

But...in the last few days the Raspberry Pi image has been updated from Buster to Debian 11 "Bullseye".

I've followed the instructions at https://hub.docker.com/r/domoticz/domoticz and created a docker-compose.yml file.

I then type:

Code: Select all

docker-compose up -d 
and the container appears to run.
But when I type

Code: Select all

docker ps
I see this:

Code: Select all

CONTAINER ID   IMAGE               COMMAND                  CREATED         STATUS                            PORTS     NAMES
9cbe2cc9fbe3   domoticz/domoticz   "docker-entrypoint.s…"   2 minutes ago   Restarting (139) 21 seconds ago             domoticz
I've also tried running "docker run" (from the How to Use section) followed by the various settings and get no running container at all or the same result as above if I include "--restart=unless-stopped" in the command.

I've tried to enable logging within the yml file but I can't find the log to look for clues.

Any ideas please anyone?
Thanks
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 »

Hello,

Just launch the container with « docker-compose up » to see the logs.
Without « -d », the container will not go to background, and you’ll see the logs.
tarmacalastair
Posts: 94
Joined: Wednesday 30 October 2019 14:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Great Britain
Contact:

Re: Oficial Docker Container

Post by tarmacalastair »

Thanks for the tip. Sadly it didn't work - the logs only seem to appear if the container launches successfully.

But, apologies, I realised that installing docker-compose from the repos resulted in apt uninstalling the previous docker (installed via the Dashticz script at https://dashticz.readthedocs.io/en/mast ... stall.html) and replacing with the apt versions, like this:

Code: Select all

The following packages will be REMOVED:
  containerd.io docker-ce docker-ce-cli docker-ce-rootless-extras
The following NEW packages will be installed:
  containerd docker-compose docker.io runc
I went back to the docker version that I had been using (docker-ce) and ran Domoticz directly (without docker-compose) and this version of docker produced an error which explained everything (The requested image's platform does not match the detected host platform) - I had tried to be clever and was running this test on a different pi which I hadn't realised was an ancient model 1b. I put the SD card into the Pi3 that I'd originally been using and it worked fine.

So, apologies, silly mistake on my part trying to run docker on such old hardware.
Running Domoticz and Dashticz beta on Raspberry Pi OS 32 bit - has anyone had success with 64 bit?

Desktop access from Ubuntu Linux
wizzard72
Posts: 116
Joined: Friday 20 December 2013 7:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Oficial Docker Container

Post by wizzard72 »

I'm running domoticz in a docker container. The problem that I have is that my plugin uses the Session() to communicate. If I request a page it takes about 1 minute or longer to complete. On my test VM it takes seconds. This causes the plugin to end unexpectedly. I checked if requests (Session is part of requests) is installed inside the docker container and it is.

Any clue what might be the problem?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest