I generally let my server do its thing, but I run into an issue consistently when I install system updates and then reboot: Some docker containers come online, while others need to be started manually. All containers were running before the system shut down.

  • My containers are managed with docker compose.
  • Their compose files have restart: always
  • It’s not always the same containers that fail to come online
  • Some of them depend on an NFS mount point being ready on the host, but not all

Host is running Ubuntu Noble

Most of these containers were migrated from my previous server, and this issue never manifested.

I wonder if anyone has ideas for what to look for?

  • @WhyJiffie@sh.itjust.works
    link
    fedilink
    English
    922 hours ago

    I have recently discovered what was causing this to me for years. It was IP specific port bindings. Ports of a few containers were only bound for the LAN IP of the system, but if DHCP couldn’t obtain an IP until the Docker service started its startup, then those containers couldn’t be started at all, and Docker in it’s wisdom won’t bother with retrying.

    The reasons to move my compose stacks to separate systemd services are counting.

  • @CameronDev@programming.dev
    link
    fedilink
    English
    51 day ago

    Can you make your docker service start after the NFS Mount to rule that out?

    A restart policy only takes effect after a container starts successfully. In this case, starting successfully means that the container is up for at least 10 seconds and Docker has started monitoring it. This prevents a container which doesn’t start at all from going into a restart loop.

    https://docs.docker.com/engine/containers/start-containers-automatically/#restart-policy-details

    If your containers are crashing before the 10 timeout, then they won’t restart.

  • @schizo@forum.uncomfortable.business
    link
    fedilink
    English
    41 day ago

    I hate to be that guy, but uh, what do the logs say?

    The container logs would probably be most useful since you should (probably) be able to tell if they’re having issues starting and/or simply not attempting to launch at all.

  • @mbirth@lemmy.ml
    link
    fedilink
    English
    124 hours ago

    Put that mount point into the compose file(s). You can define volumes with type nfs and basically have Docker-Compose manage the mounts.

  • @just_another_person@lemmy.world
    link
    fedilink
    English
    11 day ago

    Add a healthcheck to test the mount directory. If it’s deemed unhealthy, the container should restart until it passes. If your NFS mount is automounting properly, you should fix that though.