Skip to content

Runners created by a 0.27.2 controller failing with dial unix /run/docker/docker.sock: connect: permission denied #2490

Closed

Description

@Tyrion85

Checks

Controller Version

0.27.2

Helm Chart Version

0.23.0

CertManager Version

No response

Deployment Method

Helm

cert-manager installation

Yes

Checks

  • This isn't a question or user support case (For Q&A and community support, go to Discussions. It might also be a good idea to contract with any of contributors and maintainers if your business is so critical and therefore you need priority support
  • I've read releasenotes before submitting this issue and I'm sure it's not due to any recently-introduced backward-incompatible changes
  • My actions-runner-controller version (v0.x.y) does support the feature
  • I've already upgraded ARC (including the CRDs, see charts/actions-runner-controller/docs/UPGRADING.md for details) to the latest and it didn't fix the issue
  • I've migrated to the workflow job webhook event (if you using webhook driven scaling)

Resource Definitions

apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
  name: xxx
spec:
  replicas: 1
  template:
    spec:
      labels:
      - self-hosted
      - linux
      - xxx
      organization: xxx
      resources: {}

To Reproduce

1. Upgrade runner-controller to summerwind/actions-runner-controller:v0.27.2
2. Create a runner
3. Watch runner container logs

Describe the bug

After an upgrade of runner-controller to v0.27.2, an error is thrown in runner:

runner Got permission denied while trying to connect to the Docker daemon socket at unix:///run/docker/docker.sock: Get "http://%2Frun%2Fdocker%2Fdocker.sock/v1.24/containers │
│ /json": dial unix /run/docker/docker.sock: connect: permission denied

which prevents it from ever picking up a Github job to work on.

Same runner works fine in v0.27.1, v0.27.0, v0.26.0

Describe the expected behavior

An error not to be thrown, and runner to pick up a job from Github like it did in v0.27.1 and below

Whole Controller Logs

Nothing of interest in the logs:

 2023-04-06T10:45:30Z    DEBUG    runner    Runner appears to have been registered and running.    {"runner": "yy/xxxx-gbw9x-md9pg", "podCreationTimestamp": "2023-04-06 10:4 │
│ 5:27 +0000 UTC"}


The pod is up technically but the runner container is failing internally.

Whole Runner Pod Logs

Got permission denied while trying to connect to the Docker daemon socket at unix:///run/docker/docker.sock: Get "http://%2Frun%2Fdocker%2Fdocker.sock/v1.24/containers/json": dial unix /run/docker/docker.sock: connect: permission denied

Additional Context

GKE 1.24.

Same runners work in v0.27.1 and below (tried v0.27.0 and v0.26.0 as well).

Possibly a consequence of #2324 ? Not sure, didn't have time to dig in further. I reverted controller to v0.27.1.

v0.27.2 upgrade was important because of failing metrics server on versions below v0.27.2 (fix was added in that version).

Activity

  1. added
    bug
    needs triage
    on Apr 6, 2023
  2. github-actions commented on Apr 6, 2023

    @github-actions
    Contributor

    Hello! Thank you for filing an issue.

    The maintainers will triage your issue shortly.

    In the meantime, please take a look at the troubleshooting guide for bug reports.

    If this is a feature request, please review our contribution guidelines.

  3. totogtr commented on Apr 6, 2023

    @totogtr
    Contributor

    Experiencing the same issue, had to rollback to v0.27.1 as well.

  4. alexklibisz commented on Apr 6, 2023

    @alexklibisz

    Experienced the same issue on:

    • chart version 0.23.1
    • controller version 0.27.2
    • runner version v2.299.1-ubuntu-20.04

    Logs show:

    Got permission denied while trying to connect to the Docker daemon socket at unix:///run/docker/docker.sock: Get "http://%2Frun%2Fdocker%2Fdocker.sock/v1.24/containers/json": dial unix /run/docker/docker.sock: connect: permission denied

    Cannot connect to the Docker daemon at unix:///run/docker/docker.sock. Is the docker daemon running?

    All works fine on chart version 0.23.0, controller 0.27.1, same runner.

  5. Atsoamazed commented on Apr 6, 2023

    @Atsoamazed

    Was able to get pass this error by setting

    dockerdWithinRunnerContainer: true

    In the runnerdeployment manifest

  6. asonnleitner commented on Apr 7, 2023

    @asonnleitner

    Same

    Experiencing the same issue, had to rollback to v0.27.1 as well.

  7. roulettedares commented on Apr 8, 2023

    @roulettedares

    same issue on GKE 1.24.

  8. mumoshu commented on Apr 10, 2023

    @mumoshu
    Collaborator

    I greatly appreciate your detailed report @Tyrion85!

    Possibly a consequence of #2324 ?

    Yeah, it could be! Let me reproduce it first.

    To be clear, it didn't happen on my env when I E2E-tested it before releasing v0.27.2 so I'm pretty unsure how I could reproduce it!

    In the meantime, everyone, I'd appreciate it if you could bring any more details than "me too"!

    Is this happening only on GKE?
    Hey @asonnleitner @Atsoamazed @alexklibisz 👋Thanks for reporting. Are you using GKE? If so, which K8s versions are you using?

  9. vanhtuan0409 commented on Apr 10, 2023

    @vanhtuan0409

    somehow with v0.27.2, DOCKER_HOST env var changed to unix:///run/docker/docker.sock instead of using tls://.
    Combination with docker group id mismatch between runner container and docker container resulted in the above permission denied error
    Currently we have 2 workaround:

    1. Setting dockerdWithinRunnerContainer: true to make both runner and docker run in the same container as @Atsoamazed mentioned above
    2. Update env var from docker container to match with runner group id as following
    apiVersion: actions.summerwind.dev/v1alpha1
    kind: RunnerSet
    spec:
      template:
        spec:
          containers:
           - name: docker
             env:
                - name: DOCKER_GROUP_GID
                  value: "1001"
    
    
  10. mumoshu commented on Apr 10, 2023

    @mumoshu
    Collaborator

    @vanhtuan0409 Hey! Thanks a lot for the info. I'm now confused why the GID envvar had to be set to 1001 in your case. I thought our runner images use 121-

    https://github.com/search?q=repo%3Aactions%2Factions-runner-controller%20DOCKER_GROUP_GID&type=code

    It's plausible to use 121 as the default DOCKER_GROUP_GID as we've done in#2324, right...?

  11. vanhtuan0409 commented on Apr 10, 2023

    @vanhtuan0409

    it seems like there is some issue in the docker publish pipeline. The controller is currently using docker hub image, which will have docker gid set to 1001

    you can easily check on dockerhub with this link https://hub.docker.com/layers/summerwind/actions-runner/latest/images/sha256-202c64d20e5a35511eb541df7e6d72fd7e415d712c669a4783f48bd39c70fc68?context=explore

    or by running a simple container for inspection
    image

  12. asonnleitner commented on Apr 10, 2023

    @asonnleitner

    @mumoshu I actually use EKS 1.25

  13. nobbs commented on Apr 10, 2023

    @nobbs

    @vanhtuan0409 Hey! Thanks a lot for the info. I'm now confused why the GID envvar had to be set to 1001 in your case. I thought our runner images use 121-

    The Ubuntu 22.04 one has the gid set to 121,

    The one base on Ubuntu 20.04 has not

    - maybe that’s the reason for the mismatch.

    Anyway, had the same issues on a on-prem cluster based on Rancher / RKE1.

  14. mumoshu commented on Apr 10, 2023

    @mumoshu
    Collaborator

    @nobbs Ahhh got it...! Thank you so much for pointing it out!! That must be the cause.
    Presuming many folks are still stuck in Ubuntu 20.04, shall we let ARC use 1001 by default, and use 121 only when the image tag contains "22.04"?

  15. 7 remaining items

  16. torokati44 commented on Apr 14, 2023

    @torokati44

    I was also affected by this, and the DOCKER_GROUP_GID envvar workaround worked for me as well.

  17. mrparkers commented on Apr 14, 2023

    @mrparkers

    @mrparkers as a work around rather than socat couldn't you just create a link from the socket to /var/run/docker.sock? As long as you have permissions on the socket that should work.

    I tried this approach too. I believe that this won't work unless the symlinked directory is also mounted to the container, meaning I would have to also mount /var/run/docker too. I don't think there's an easy way to do this across my entire GitHub org, I'd probably have to update individual jobs to mount these directories manually. This seems like a worse solution than simply remaining on v0.27.1 for now.

  18. mumoshu commented on Apr 15, 2023

    @mumoshu
    Collaborator

    Hey everyone! #2499 should generally fix this. Could you read the description of #2499 and confirm that you'll no longer be affected by this issue after that? Thanks!

  19. nobbs commented on Apr 15, 2023

    @nobbs

    Hey everyone! #2499 should generally fix this. Could you read the description of #2499 and confirm that you'll no longer be affected after that? Thanks!

    I've tried your fix and at least I don't face any issues with the default Ubuntu 20.04/22.04 runners anymore. Thanks!

  20. nobbs commented on Apr 16, 2023

    @nobbs

    Regarding the issue reported by @mrparkers in #2490 (comment), I can replicate that, too.

    Using the default runners with sidecar dind, the docker socket is now available on /var/run/docker/docker.sock instead of /var/run/docker.sock potentially breaking dockerfile based actions if they try to use docker from inside the Dockerfile based action. I don't think that this can be solved by modifying actions or anything, as the action runner constructs the arguments it sets for the docker run calls when using Dockerfile based actions.

    The sidecar-less setup with dind still works as expected as the /var/run/docker.sock is available.

    My guess is, that #2324 introduced this change in this block: https://github.com/milas/actions-runner-controller/blob/480a83d90d5b81a10b92a7a61d7cc8b4973655cc/controllers/actions.summerwind.net/runner_controller.go#L1005-L1032

  21. torokati44 commented on Apr 17, 2023

    @torokati44

    Can confirm, v0.27.3 fixed the problem for me as well.
    Thank you!

  22. mrparkers commented on Apr 17, 2023

    @mrparkers

    I have opened another issue for the problem that I detailed above, which is still not resolved in v0.27.3: #2519

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

    bugneeds triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions