Permission Denied while trying to connect to Docker Daemon while running Jenkins pipeline in Macbook

This is a docker permission issue. Add the jenkins user to docker group as follow:

usermod -aG docker ${USER}


There are any ways to solve this issue, I faced it last week, I solved but with docker-compose this setup is replicable to docker, you can create a shared volume that points from the location of docker.sock in your host /var/run/docker.sock to location of docker.sock in your container /var/run/docker.sock. Something like this:

version: '2'
services:
  jenkins:
    build:
      context: ./jenkins
    ports:
      - "8080:8080"
    expose:
      - "8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/bin/docker:/usr/bin/docker
      - /usr/local/bin/docker-compose:/usr/local/bin/docker-compose

  nginx:
    build:
      context: ./nginx
    container_name: "prueba"
    links:
      - jenkins
    ports:
      - "80:80"
    depends_on:
      - jenkins

To works well you have to give permissons of user to the socketsudo chown $USER:$USER /var/run/docker.sock and to the group of docker , as Innocent Anigbo mentioned.