Skip to content

Provide runner as a Docker Image #367

Closed

Description

@WtfJoke

Describe the enhancement
Is it possible for you to provide official docker images for letting a runner run?

Additional information
We want to use self hosted runner, but we dont want to maintain machines/vms so it would be cool to have a ready to run official docker image in order to use them in services like aws fargate/azure container instances.

If im wrong here and I should have opened a topic in the github actions community forum please let me know and feel free to close the issue/feature request.

Activity

  1. added
    enhancement
    on Mar 11, 2020
  2. vincentbrison commented on Mar 11, 2020

    @vincentbrison

    Some example of runner as a Docker image:

    Additionally, Runner running in Docker is not able to use Docker itself:

    throw new NotSupportedException("Container feature is not supported when runner is already running inside container.");

    This is a major downside, as we can not yet manage self hosted runners with Kubernetes for example, as we have to manage VMs or real machines.

  3. WtfJoke commented on Mar 13, 2020

    @WtfJoke
    Author

    Thank you @vincentbrison for providing these examples, I found a couple of them as well, but I am not sure if we are allowed to use them in our company (we have a restriction to use only official images). Thats the reason why I asked here. :)

    The hint about docker in docker is useful (a couple of application suffer of this problem). 👍

  4. ppamorim commented on Aug 4, 2021

    @ppamorim

    I don't understand this limitation, what's the difference between this and a VM running in the machine? We are using M1 machines as our hosts and since the native runner on macOS does not support containers, we decided to use Docker, but when executing it, we get this error.

  5. scolastico commented on Oct 10, 2021

    @scolastico

    Also its possible with docker to run a docker conatiner in a docker container.
    You only need to mount the docker directory /var/lib/docker in the normal file system so it doesnt gets mounted as an AUFS mountpoint.

    This page i found describes a bit better than me: https://www.docker.com/blog/docker-can-now-run-within-docker/

  6. pdomagala-tl commented on Feb 22, 2022

    @pdomagala-tl

    @scolastico did you manage to do this?

  7. pdomagala-tl commented on Feb 22, 2022

    @pdomagala-tl

    are you able to run docker inside the docker container?

  8. scolastico commented on Feb 23, 2022

    @scolastico

    Run docker inside docker: Yes with the link from above (https://www.docker.com/blog/docker-can-now-run-within-docker/).
    But my solution from my last comment was not from that. My main problem why i saw that issue was that i wanted clean runner instances for selfhosting and so i developed a small programm which exactly does this. Its starting automatically runners as they are needed and deletes used ones.

  9. nikola-jokic commented on Dec 22, 2022

    @nikola-jokic
    Contributor

    Hey everyone,

    There is a bare-minimum runner image available now: ghcr.io/actions/actions-runner:latest
    The Dockerfile is available here.

    It is now part of the release process (#2250). The idea is to provide an image that can be used by actions-runner-controller, but also as a stand-alone image.

  10. danm commented on Jan 6, 2023

    @danm

    hi @nikola-jokic how do you use this image?

    docker run ghcr.io/actions/actions-runner:2.300.2 ?

  11. nikola-jokic commented on Jan 9, 2023

    @nikola-jokic
    Contributor

    Hey @danm,

    You would need to provide an entrypoint. Keep in mind, the entrypoint should know how to configure and run the runner. The entrypoint by default does not exist. So imperatively, you can provide an --entrypoint with docker run, or you can use this Dockerfile as a base for building your own minimal runner image.

  12. Spriz commented on Jan 17, 2023

    @Spriz

    Hi @nikola-jokic - thanks for providing those Dockerfiles - is there any plans to support docker in docker? We're in the process of migrating from Gitlab CI/CD to Github Actions and it seems quite agressive to run autoscaling VMs compared to running 1-2 dedicated machines that runs 5-10 instances (that are ephemeral) of that container.

    Either being able to use docker-in-docker, or having the agent support multiple workspaces on the same VM would both solve this.

  13. CarlSargunar commented on Apr 13, 2023

    @CarlSargunar

    @danm did you get this runner working?

    @nikola-jokic - I'm afraid I am not entirely following - could you elaborate on what needs to be done for the entry point? If I understand this right, by using the dockerfile you link to we can create our own images to set up runners and manage these?

    Thanks in advance

  14. danm commented on Apr 13, 2023

    @danm

    Hi @CarlSargunar
    This is the way we are creating the runner using Docker.

    Create a directory with 2 files, Dockerfile and runner.sh

    The Dockerfile could look like this...

    Dockerfile

    FROM ghcr.io/actions/actions-runner:latest
    RUN sudo apt update -y && sudo apt install build-essential git curl -y
    
    RUN curl -sL https://deb.nodesource.com/setup_16.x -o ./tmp/nodesource_setup.sh
    RUN sudo chmod +x ./tmp/nodesource_setup.sh
    RUN sudo ./tmp/nodesource_setup.sh
    
    COPY ./runner.sh .
    CMD ["./runner.sh"]

    runner.sh

    #!/bin/sh
    
    ./config.sh --url https://github.com/$REPO --token $TOKEN --name $NAME --unattended
    sudo ./bin/runsvc.sh

    Run docker build --no-cache -t docker/github-runner . to build your image.
    Run docker run docker/github-runner

    Though I don't think you are supposed to use runsvc.sh anymore. Check the docs for the recommended. But it works great!

  15. uhthomas commented on Mar 19, 2024

    @uhthomas

    For anyone stumbling upon this in future, this one command should be enough. Just replace the URL and token.

    ❯ docker run -it ghcr.io/actions/actions-runner:2.314.1 sh -c './config.sh --url https://github.com/<user or org>/<repo> --token <token> --unattended && ./run.sh'

    (use docker run -d instead of docker run -it to run in the background)

  16. dorinclisu commented on Mar 12, 2025

    @dorinclisu

    Here's my docker compose solution that survives host reboot, it works around the limitation that runner registration config paths are hardcoded. https://github.com/dorinclisu/devops-setup/tree/main/github_runner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions