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.


  • 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

    • Offizieller Beitrag

    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 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    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.

    • Offizieller Beitrag

    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 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    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.

    • Offizieller Beitrag

    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 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    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!

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!