question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HOME is overridden for containers

See original GitHub issue

Describe the bug If passing the HOME environment variable to a container configuration, it will get ignored and set to /github/home anyway as per https://github.com/actions/runner/blob/4e85b8f3b7493aa1adf9dd0a574a9fa2bf1add71/src/Runner.Worker/ContainerOperationProvider.cs#L258

To Reproduce

A workflow with

jobs:
  main:
    runs-on: ubuntu-latest
    container:
      image: 'rokmoln/sf-ubuntu-bionic-common:0.2.80'
      options: '--user sf:sf' # this user's home is /home/sf
      env:
        HOME: /home/sf # tried to change HOME from /github/home to /home/sf. doesn't work
    steps:
      - shell: bash
        run: |
          echo $HOME

will echo /github/home instead of /home/sf.

Expected behavior Expected HOME to be left as is, as sf user’s HOME, or at the very least to be allowed to enforce it via the env dictionary.

Runner Version and Platform

2.274.2

What’s not working?

N/A

Job Log Output

N/A

Runner and Worker’s Diagnostic Logs

N/A

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:49
  • Comments:20 (3 by maintainers)

github_iconTop GitHub Comments

12reactions
andreineculaucommented, Jun 11, 2021

@Hoxu you touched on the most important bit:

On a related note, it would be really nice if the GitHub runner’s parameters to docker containers were documented clearly somewhere.

10reactions
andreineculaucommented, Dec 15, 2020

If I may suggest a possible solution:

  • set HOME only if not already set
  • set GITHUB_HOME or GITHUB_RUNNER_HOME in order to allow devs not to hardcode /github/home in case there’s a use-case to access the runner’s home from inside a container.
Read more comments on GitHub >

github_iconTop Results From Across the Web

GitHub Actions ignores/overrides Docker container's ...
Looking at the log, it appears that the container was created with --entrypoint "tail" , causing the run.sh script to be ignored. I...
Read more >
Overriding the user Docker containers run as.
The lack of a home directory means that even if we update the IPython Docker image to run as the 'www-data' user, it...
Read more >
Define Environment Variables for a Container
This page shows how to define environment variables for a container in a Kubernetes ... override any environment variables specified in the container...
Read more >
infra docker-container --override volumes not a valid list
DockerContainer.volumes is a list but prefect deployment build --override volumes=/host/path:/container/path puts a string in the YAML.
Read more >
docker run
The docker run command runs a command in a new container, pulling the image if needed ... --detach-keys, Override the key sequence for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found