Skip to content

Report init.sh setup failures and fix golangci-lint flags in readme - #51

Merged
umputun merged 3 commits into
masterfrom
init-diagnostics-and-readme-lint
Aug 20, 2026
Merged

Report init.sh setup failures and fix golangci-lint flags in readme#51
umputun merged 3 commits into
masterfrom
init-diagnostics-and-readme-lint

Conversation

@paskal

@paskal paskal commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Two independent fixes.

init.sh reports failed setup steps. The timezone setup, the APP_UID substitutions in /etc/passwd and /etc/group, and the chown of /srv and /home/app all ran unchecked, so an invalid TIME_ZONE, a read-only /etc, or a read-only mount under /home/app left the container running with the wrong timezone, uid or ownership without anything in the log pointing at it. Each of those steps is now checked and reports what failed and what the container falls back to, and the set timezone line is printed only when both halves of the timezone setup succeeded. The APP_UID substitutions are additionally verified against the resulting user and group, because sed exits 0 when its pattern is not found, which is what happens in a derived image whose app entries no longer use 1001. Error messages are printed even with INIT_QUIET=1, since they are not informational.

Startup behaviour is deliberately unchanged: every step is still attempted, none of these failures stop the container, and the only exits remain the pre-existing ones for docker group setup and for a failing /srv/init.sh.

Checked against locally built images: default run, TIME_ZONE=Nope/Nope, /etc/localtime and /etc/timezone each mounted read-only in turn, APP_UID=2000, DOCKER_GID both free and colliding with the ping group, SKIP_HOME_CHOWN=1, a read-only mount under /home/app, INIT_QUIET=1 with and without a failure, /srv/init.sh both succeeding and failing, and three derived images whose app entries the substitutions cannot match: uid 1500 in /etc/passwd, gid 1600 in /etc/group, and uid 2000 with primary gid 1700. Every failing case names the step that failed and still starts the command under the app user, apart from the failing /srv/init.sh, which keeps exiting 1 as before.

Readme lint command. The build image bundles golangci-lint v2, which dropped --out-format, so both documented multi-stage Dockerfiles fail at the lint step with unknown flag: --out-format. Both examples now use the v2 form, --output.tab.path=stdout, checked inside the published buildgo image.

paskal added 2 commits August 20, 2026 08:06
Previously, the timezone setup, the APP_UID substitutions in /etc/passwd
and /etc/group, and the chown of /srv and /home/app ran unchecked, so a
missing zone file, a read-only /etc or a read-only mount left the
container running with the wrong timezone, uid or ownership and nothing
in the log pointed at it.

After this change every one of those steps is checked and reports what
failed and what the container falls back to, and the "set timezone"
line is printed only when both halves of the timezone setup succeeded.
The APP_UID substitutions are additionally verified against the
resulting user and group, since sed exits 0 when the pattern is not
found, which happens in a derived image whose app entries no longer use
1001.

The messages are printed even with INIT_QUIET=1, since they are not
informational. Startup behaviour is unchanged: every step is still
attempted, none of these failures stop the container, and the only
exits remain the pre-existing ones for docker group setup and for a
failing /srv/init.sh.
The image bundles golangci-lint v2, which dropped --out-format, so both
documented multi-stage Dockerfiles fail at the lint step with "unknown
flag: --out-format". Use the v2 equivalent, --output.tab.path=stdout.
@umputun
umputun merged commit 3c694b4 into master Aug 20, 2026
13 checks passed
@umputun
umputun deleted the init-diagnostics-and-readme-lint branch August 20, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants