my-bloody-jenkins icon indicating copy to clipboard operation
my-bloody-jenkins copied to clipboard

Error on OSx: failed: Permission denied: /var/run/docker.sock

Open yorammi opened this issue 2 years ago • 1 comments

In the last versions only (current LTS: 2.289.2-256), I've started to get the following error when a job is trying to start an agent: java.net.ConnectException: connect(..) failed: Permission denied Caused: io.netty.channel.AbstractChannel$AnnotatedConnectException: connect(..) failed: Permission denied: /var/run/docker.sock

It didn't fail on this on older versions. Posts that can help solving this: https://stackoverflow.com/questions/44999000/permission-denied-error-invoking-docker-on-mac-host-from-inside-docker-ubuntu-co https://stackoverflow.com/questions/56827949/jenkins-dial-unix-var-run-docker-sock-connect-permission-denied-macos https://stackoverflow.com/questions/47854463/docker-got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socke

yorammi avatar Jul 22 '21 06:07 yorammi

Thanks @yorammi. This is a change in Docker For Mac. It is not something that can be fixed within the image, but externally.

I think the best way to mitigate it, would be to run docker:dind within the docker-compose and change the configuration of the docker plugin to point to the docker within docker...

Something like that (docker-compose):

  docker:
    image: docker:dind
    privileged: true
    volumes:
      - docker-certs:/certs
    environment:
      DOCKER_TLS_CERTDIR: ''


  jenkins:
    image: odavid/my-bloody-jenkins
  ...
    environment:
      DOCKER_HOST: tcp://docker:2375
      DOCKER_TLS_CERTDIR: ''
   

and within the confiugration:

clouds:
  docker-cloud:
    type: docker
    dockerHostUri: 'tcp://docker:2375'

odavid avatar Jul 28 '21 20:07 odavid