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.

Self Hosted Runner running in a container fails to run steps inside a service container "sh: 0: Can't open /__w/_temp/xxx.sh"

See original GitHub issue

Describe the bug Hey,

My self-hosted runner is basically a container in itself that has access to the docker daemon socket. This allow it to perform docker cli commands, useful for all kinds of operations. For simple stuff it’s quite neat and works as expected.

Now, I am trying to create a workflow that starts up a container and then tries to run its steps inside that container.

But it seems that it can’t even load some simple bash “run” steps such as echo "test" and returns this instead:

Run echo "test"
  echo "test"
  shell: sh -e {0}
sh: 0: Can't open /__w/_temp/8e725f1d-7b7b-42e6-b0ad-103fa9200580.sh
Error: Process completed with exit code 127.

If I define the shell parameter with value bash in the run step, I get something slightly different:

bash: /__w/_temp/baf2900f-87a1-4447-8b71-965fe79bef7d.sh: No such file or directory
Error: Process completed with exit code 1.

To Reproduce Here’s my yaml section in question:

.....
build-environment:
    needs: get-ecr-credentials
    runs-on: [self-hosted, gh-medium-x86]

    container: 
      image: <my-custom-image-in-ecr>
      credentials:
        username: AWS
        password: ${{needs.get-ecr-credentials.outputs.password}}
      options: >-
        --log-driver journald
        --log-opt tag=mytag

    steps:
    - name: Test Run
      run: echo "yeah"

Expected behavior Runner runs the echo step inside my custom image without erroring out

Runner Version and Platform

myoung34/github-runner:2.276.1-ubuntu-bionic

Amazon Linux 2 x86_64


EDIT 16/2:

Tried with setting privileged=true for the runner container, got the same errors

Tried also to use another non-custom container straight from the docker hub (i.e ubuntu:20.04), got the same errors

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

2reactions
dimisjimcommented, Mar 10, 2021

@djcarpe This is caused due to the lack of support for running the runner application inside docker: https://github.com/actions/runner/issues/406

0reactions
preincommented, Jul 12, 2023

Not sure if it helps but mounting the workdir from the host using dockerVolumeMounts in the ARC RunnerDeployment helps

Read more comments on GitHub >

github_iconTop Results From Across the Web

GitHub action self-host runner as service fails - linux
I have installed GitHub self-hosted runner on my Ubuntu system. Getting below error when i try to configure it as service. $ sudo...
Read more >
Troubleshoot self-hosted runner
Container fails to start due to disk space. The task remains in the Preparing Environment step while the pod has a warning attached,...
Read more >
Self-hosted runner: step set up fails when trying to use ...
I'm running a self-hosted runner and whenever I try to enable docker support for individual steps, or for all steps via `options: docker:...
Read more >
Tutorial: Run GitHub Actions runners and Azure Pipelines ...
Any steps in your workflows that use Docker commands will fail when run on a self-hosted runner or agent in a Container Apps...
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