How to make containers wait for each other?

  • I need Zoneminder to wait for Home Assistant and Chronograf to wait for InfluxDB. How can I achieve this? In Docker compose there is the "depends_on" entry, but what about docker run in OMV?
    Thanks

  • I need Zoneminder to wait for Home Assistant and Chronograf to wait for InfluxDB. How can I achieve this? In Docker compose there is the "depends_on" entry, but what about docker run in OMV?
    Thanks

    No way to do this with docker omv plugin...
    You can still use docker-compose.

    Yes, you can do this with the "volumes from" area in docker. In chronograf, in the "volumes from" area add your influxdb container and hit the plus sign and restart your container. now,it will restart after influxdb.


    Build, Learn, Create.


    How to Videos for OMV


    Post any questions to the forum, so others can benefit from your curiosity. :thumbup:
    No private support.

  • It will restart chronograf container after influxdb container but there is no guarantee that application inside the container (influxdb) has started before (chronograf application).
    A container is considered as started even if the application inside has not finished to start.
    If influxdb application (not container) take more time to start than chronograf application (inside the container) ---> Error even if the influxdb container started before chronograf.


    More info :
    https://stackoverflow.com/ques…ainer-x-before-starting-y
    https://docs.docker.com/compose/startup-order/


    Docker OMV plugin does not implement real dependencies between services.

  • The idea of "volumes from" is to wait for the other container, so it can get information from it.


    Try it before you say it can't work. I found it works well for things like Nextcloud which is completely database driven.


    Why it works, is more than likely due to having the container set to restart always, so the container restarts on failure. I am guessing now, but I haven't checked. But that is the third example in your link above, so someone else has thought it through.


    Docker Compose wait for container X before starting Y

    Build, Learn, Create.


    How to Videos for OMV


    Post any questions to the forum, so others can benefit from your curiosity. :thumbup:
    No private support.

    • Official Post

    Docker OMV plugin does not implement real dependencies between services.

    It does exactly what the docker run command does. This isn't a problem with the plugin. This is easy with docker-compose.

    omv 6.1.1-1 Shaitan | 64 bit | 5.19 proxmox kernel | plugins :: omvextrasorg 6.1.1 | kvm 6.2.6 | compose 6.4.2 | mergerfs 6.3.4 | zfs 6.0.12
    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • It does exactly what the docker run command does. This isn't a problem with the plugin. This is easy with docker-compose.

    I'm not saying the plugin has a problem but it cannot implement real dependencies between services. It's the same behaviour as depends_on on docker-compose v2. You can order container startup (not true anymore with compose v3) but you cannot be sur that application inside the container has trully finished to start unless you use healthchecks or scripts (unlike omv docker plugin).
    A container is in state 'running' even if your application inside has not finished to boot.


    @TechnoDadLife: The only reason you think it works is because your database is up and running quickly and/or nextcloud (maybe) retry many connections to DB during X seconds.
    The day your database will take more time to boot that nextcloud, you will see, your nextcoud container will be stopped with errors (or restarted with restart=always) but it is not the right way to do it even more with more complex dependencies.



    "volumes from" in omv plugin or depends_on (without healthchecks or custom srcipt) in compose can only start containers in the order you define but there is nothing that can guarantee application startup time.

  • Agreed, not the right way, but it works.

    Build, Learn, Create.


    How to Videos for OMV


    Post any questions to the forum, so others can benefit from your curiosity. :thumbup:
    No private support.

    • Official Post

    I'm not saying the plugin has a problem but it cannot implement real dependencies between services.

    It isn't impossible for the plugin to have real dependencies but I'm not going to write the code. People can either use docker-compose or write a script or manually start the containers or something else.

    you cannot be sur that application inside the container has trully finished to start unless you use healthchecks or scripts (unlike omv docker plugin).

    If you set the container to start automatically and reboot the system, the plugin has nothing to do with how the containers start. Just trying to make it clear that the plugin is not causing this problem. You would have this same problem if you configured everything from the command line.

    omv 6.1.1-1 Shaitan | 64 bit | 5.19 proxmox kernel | plugins :: omvextrasorg 6.1.1 | kvm 6.2.6 | compose 6.4.2 | mergerfs 6.3.4 | zfs 6.0.12
    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • People can either use docker-compose or write a script or manually start the containers or something else.

    Agreed (my first post).


    If you set the container to start automatically and reboot the system, the plugin has nothing to do with how the containers start. Just trying to make it clear that the plugin is not causing this problem. You would have this same problem if you configured everything from the command line.

    Agreed too.


    I'm only pointing the fact that Technodadlife first post was not really true as is and added additional informations.


    ps1: I work as a DevOps Engineer, I'm a docker certified professional, I give docker courses for my company. I depoyed thousands of docker container on large scale systems (openstack, GCP, AWS) --> I understand what we are talking about.


    ps2: Do you know why this option is called "volumes_from" in OMV plugin instead of "depends_on" ? With docker, "volumes_from" tells docker to use a volume that is already defined/used by another container.

    • Official Post

    I understand what we are talking about.

    I wasn't trying to make it clear to you :) Just anyone else reading this thread. It saves me time answering issues on github where people think plugins are doing things wrong.


    Do you know why this option is called "volumes_from" in OMV plugin instead of "depends_on" ? With docker, "volumes_from" tells docker to use a volume that is already defined/used by another container.

    Nope. I didn't write it and don't use the plugin. So, not sure what nicjo originally meant.

    omv 6.1.1-1 Shaitan | 64 bit | 5.19 proxmox kernel | plugins :: omvextrasorg 6.1.1 | kvm 6.2.6 | compose 6.4.2 | mergerfs 6.3.4 | zfs 6.0.12
    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!