Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docker): set HOME environment variable explicitly in Dockerfile #9333

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gustavovalverde
Copy link
Member

@gustavovalverde gustavovalverde commented Mar 18, 2025

Motivation

The HOME environment variable was defaulting to /root when the container started, causing cache directories to be incorrectly set up under /root/.cache/zebra instead of /home/zebra/.cache/zebra

This happens as the user running the entrypoint.sh (before using gosu) is the root user

The initial intention was not to override the default linux $HOME, but in this controlled environment there's no actual benefit in not doing so.

Solution

  • This explicit setting ensures the HOME environment variable is correctly set to the zebra user's home directory.

Tests

  • Carefully check the unit tests:
    • Test default-conf in Docker
    • Test testnet-conf in Docker
    • Test custom-conf in Docker

As their exit code is not being handled correctly

Follow-up Work

  • Docker configuration tests should exit with the appropriate exit code when this kind of scenarios happen

PR Checklist

  • The PR name is suitable for the release notes.
  • The solution is tested.
  • The documentation is up to date.
  • The PR has a priority label.
  • If the PR shouldn't be in the release notes, it has the
    C-exclude-from-changelog label.

The HOME environment variable was defaulting to /root when the container started, causing cache directories to be incorrectly set up under /root/.cache/zebra instead of /home/zebra/.cache/zebra. This explicit setting ensures the HOME environment variable is correctly set to the zebra user's home directory.
@gustavovalverde gustavovalverde added C-bug Category: This is a bug A-devops Area: Pipelines, CI/CD and Dockerfiles P-Critical 🚑 labels Mar 18, 2025
@gustavovalverde gustavovalverde requested a review from a team as a code owner March 18, 2025 12:12
@gustavovalverde gustavovalverde requested review from oxarbitrage and removed request for a team March 18, 2025 12:12
@gustavovalverde gustavovalverde added the C-exclude-from-changelog Category: The PR should be excluded from the changelog and release notes label Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-devops Area: Pipelines, CI/CD and Dockerfiles C-bug Category: This is a bug C-exclude-from-changelog Category: The PR should be excluded from the changelog and release notes P-Critical 🚑
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant