Using Jenkins on Kubernetes plugin and using Jenkins as a code.
I'm getting this error when trying to use 'docker build'
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
- I tried to mount /var/run/docker.sock.. but still not working..
- I tried to use runAsUser: root to run with root permissions... but still not working..
My Jenkins as a code pod template configuration -
Jenkins:config:
chart: jenkins
namespace: default
repo: https://charts.jenkins.io
values:
agent:
enabled: true
podTemplates:
jenkins-slave-pod: |
- name: jenkins-xxx-pod
label: ecs-slave
serviceAccount: jenkins-xxx-prod
containers:
- name: main
image: '805xxxx.dkr.ecr.us-west-2.amazonaws.com/slave:ecs-xxxx-node_master-3'
command: "sleep"
args: "30d"
privileged: true
runAsUser: root
volumes:
- hostPathVolume:
hostPath: "/var/run/docker.sock"
mountPath: "/var/run/docker.sock"