Combines various startup requirements into its Healthcheck to delay startup of dependent containers
1.2K
A hacky Docker image that hijacks dockers healthcheck and depends_on mechanism to delay startup of other containers. This enables injection of dependencies on non-container related requirements, such as system uptime or file presence.
This image implements a HealthCheck that will remain in startup / unhealthy until a selection of requirements is satisfied. These can be configured using environment variables listed below. These requirements are skipped when no value is provided, and processed in the order listed.
MIN_SYSTEM_UPTIME: System uptime (in seconds) must be greater than the value provided.REQUIRED_FILES: A list of Files or Directories that must exist, separated by |.
REQUIRED_CONTAINER_NAMES: A list of Container names that must be up and Healthy, separated by |.
depends_on option, such as the restart of the services listed under depends_on when a service is force-recreated.The following docker compose config causes the startup of jellyfin to be delayed until the system has been up at least 5 minutes, The external HDD is mounted (containing the media library), And Authentik authentication system is up and running.
services:
media_stack_delay:
image: robomagus/docker-dependency-delay:latest
container_name: media_stack_delay
restart: unless-stopped
environment:
- MIN_SYSTEM_UPTIME=300
- REQUIRED_FILES=/ext-storage/lost+found
- REQUIRED_CONTAINER_NAMES=authentik_worker|authentik_server
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /ext-storage:/ext-storage:ro
jellyfin:
image: linuxserver/jellyfin:latest
container_name: jellyfin
restart: unless-stopped
depends_on:
media_stack_delay:
condition: service_healthy
volumes:
- /ext-storage/data/media:/data
Content type
Image
Digest
sha256:281ca6e99…
Size
89 MB
Last updated
8 months ago
docker pull robomagus/docker-dependency-delay