basforge

Search titles, text and the “If it doesn’t work” cases.

    RU

    Whether up -d recreates a service shows in the config hash

    up -d recreates a container only if its final config changed. docker compose config --hash '*' before and after an edit tells you in advance.

    The hash is computed from the service’s final config, with values from .env substituted. So it also confirms that a “cosmetic” edit, like moving a value into .env, changed nothing:

    docker compose config --hash '*' > /tmp/h_before
    # … edit compose or .env …
    docker compose config --hash '*' | diff /tmp/h_before - && echo "no changes — up -d won't touch anything"

    diff prints the lines of services whose hash changed: those are the ones up -d will recreate. Empty output and the “no changes” line mean the containers stay as they are.

    This check backs moving a Basic Auth hash into .env (The $ sign), pulling found secrets out before the first commit (Server configs in git) and the edit script with automatic rollback (An edit script with automatic rollback).