Docker system.d service not working (domoticz)

  • Hello I am trying to run domoticz on boot as a docker container, so I have the following "domoticz.service" file in /storage/.config/system.d



    After a reboot the domoticz container starts (I can see it running from "docker ps" command), but after some seconds it suddenly stops. If I enable the parameter "Restart" to "Allways" the docker container keeps starting and stopping in a loop.


    If I check the container logs with the command "docker logs domoticz", I get the following:



    If I run the ExecStart command manually it works perfectly. What is wrong?


    Thanks!

  • It starts for me fine. What was the command to create domoticz container?

    Better support for Amlogic devices: use CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)

  • Why don't you use the docker addon?

  • It starts for me fine. What was the command to create domoticz container?


    Code
    1. docker create --name=domoticz -e PUID=0 -e PGID=0 -e TZ=Europe/Madrid -p 7070:8080 -p 6144:6144 -p 7443:1443 -v /storage/domoticz/:/config --device /dev/ttyACM0:/dev/ttyACM0 --restart unless-stopped linuxserver/domoticz
  • Why don't you use the docker addon?

    I am using docker as an addon, installed from Libreelec repository (service.system.docker).

    I have found that there is a domoticz addon from Linuxserver repository, but I feel more confident managing docker from the command line.

  • When creating docker try without --restart unless-stopped.

    Better support for Amlogic devices: use CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)

  • When creating docker try without --restart unless-stopped.

    I have created the docker container removing that parameter but nothing changes.


    It seems that domoticz is started but then somehow it exits/gets killed.


    If I run the command "systemct start domoticz.service" and just after that I run "systemctl status domoticz" I get the following:


    Code
    1. ● domoticz.service - Domoticz Container
    2. Loaded: loaded (/storage/.config/system.d/domoticz.service; enabled; vendor preset: disabled)
    3. Active: active (running) since Wed 2019-05-22 10:24:01 CEST; 1s ago
    4. Process: 1998 ExecStop=/storage/.kodi/addons/service.system.docker/bin/docker stop domoticz (code=exited, status=0/SUCCESS)
    5. Main PID: 2274 (docker)
    6. Memory: 5.2M
    7. CGroup: /system.slice/domoticz.service
    8. └─2274 /storage/.kodi/addons/service.system.docker/bin/docker start domoticz
    9. May 22 10:24:01 kodi systemd[1]: Started Domoticz Container.


    Just after that one I run the same command and I get:



    And if I run the same command again:


    Code
    1. ● domoticz.service - Domoticz Container
    2. Loaded: loaded (/storage/.config/system.d/domoticz.service; enabled; vendor preset: disabled)
    3. Active: inactive (dead) since Wed 2019-05-22 10:25:09 CEST; 2s ago
    4. Process: 2889 ExecStop=/storage/.kodi/addons/service.system.docker/bin/docker stop domoticz (code=exited, status=0/SUCCESS)
    5. Process: 2716 ExecStart=/storage/.kodi/addons/service.system.docker/bin/docker start domoticz (code=exited, status=0/SUCCESS)
    6. Main PID: 2716 (code=exited, status=0/SUCCESS)
    7. May 22 10:25:06 kodi systemd[1]: Started Domoticz Container.
    8. May 22 10:25:07 kodi docker[2716]: domoticz
    9. May 22 10:25:09 kodi docker[2889]: domoticz

    And domoticz container is not running ("docker ps -a"):


    Code
    1. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    2. c7cf291ef6b6 linuxserver/domoticz "/init" 15 minutes ago Exited (0) 5 minutes ago domoticz



    What can I do?

    Thanks!

  • After you create domoticz container do you run it from console to initialize it? Because I can run it just fine.

    Code
    1. docker start domoticz
    2. # look if completely started with
    3. docker logs domoticz

    Better support for Amlogic devices: use CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)

  • After you create domoticz container do you run it from console to initialize it? Because I can run it just fine.

    Code
    1. docker start domoticz
    2. # look if completely started with
    3. docker logs domoticz

    Yes, after creating the container I run for the first time with "docker start domoticz".


    Later, anytime I run from the console with "docker start domoticz" it works perfectly, that is why I do not know why is not working as a service.

  • Then I can't help you anymore. I only create container and for me it runs fine after reboot too.

    Better support for Amlogic devices: use CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)

  • Then I can't help you anymore. I only create container and for me it runs fine after reboot too.

    And how did you managed to run after reboot? autostart.sh or systemd.d? Can you share the contents of your system.d service file for domoticz?

  • Try with this Start and Stop:

    Code
    1. ExecStart=/storage/.kodi/addons/service.system.docker/bin/docker start -a domoticz
    2. ExecStop=/storage/.kodi/addons/service.system.docker/bin/docker stop -t 2 domoticz

    Better support for Amlogic devices: use CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)

  • Try with this Start and Stop:

    Code
    1. ExecStart=/storage/.kodi/addons/service.system.docker/bin/docker start -a domoticz
    2. ExecStop=/storage/.kodi/addons/service.system.docker/bin/docker stop -t 2 domoticz

    Yes, now it is wroking! Do you have any explanation for that? :S

    Thanks anyway!

  • Do you have any explanation for that? :S

    No actually. I just look around how other docker services are started and saw this small change. Maybe

    Code
    1. --attach , -a Attach STDOUT/STDERR and forward signals
    2. -t, --time int Seconds to wait for stop before killing it (default 10)

    Better support for Amlogic devices: use CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)