<p>While deploying jenkins pod in our kubernetes cluster, kubernetes return the following error:</p>

<pre><code>Error: failed to create containerd task: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/var/run/docker.sock\\\" to rootfs \\\"/run/containerd/io.containerd.runtime.v1.linux/k8s.io/jenkins/rootfs\\\" at \\\"/run/containerd/io.containerd.runtime.v1.linux/k8s.io/jenkins/rootfs/run\\\" caused \\\"not a directory\\\"\"": unknown Back-off restarting failed container
</code></pre>

<p>My Deployment yaml file:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: jenkins
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: jenkins
    spec:
      imagePullSecrets:
        - name: my-secret-key
      containers:
        - name: jenkins
          image: image-repo-url
          env:
            - name: JAVA_OPTS
              value: -Djenkins.install.runSetupWizard=false
          ports:
            - name: http-port
              containerPort: 8080
            - name: jnlp-port
              containerPort: 50000
          volumeMounts:
            - name: jenkins-home
              mountPath: /var/jenkins_home
            - name: docker-sock
              mountPath: /var/run/
            - name: docker-storage
              mountPath: /var/lib/docker
          securityContext:
            privileged: true
      volumes:
        - name: jenkins-home
          emptyDir: {}
        - name: docker-sock
          hostPath:
            path: /var/run/docker.sock
        - name: docker-storage
          emptyDir: {}

</code></pre>

<p>I tried for docker-sock volume:</p>

<pre><code>- name: docker-sock
  hostPath:
  path: /var/run/docker.sock
  type: file
--- and ---
- name: docker-sock
  hostPath:
  path: /var/run/docker.sock
  type: Socket
</code></pre>

<p>But it doesn't work. Actually, this configuration was working. But ıt doesn't work right now.</p>

<p>I tried for volume mounts:</p>

<pre><code>volumeMounts:
- name: jenkins-home
  mountPath: /var/jenkins_home
- name: docker-sock
  mountPath: /var/run/docker.sock
</code></pre>

<p>Deployment created. But Docker couldn't work.</p>

<p>We are using IBM Cloud Kubernetes Service.</p>

<p>Cluster Version:</p>

<pre><code>1.15.11_1533
</code></pre>

<p>Kubernetes Api Version:</p>

<pre><code>admissionregistration.k8s.io/v1beta1
apiextensions.k8s.io/v1beta1
apiregistration.k8s.io/v1
apiregistration.k8s.io/v1beta1
apps/v1
apps/v1beta1
apps/v1beta2
authentication.k8s.io/v1
authentication.k8s.io/v1beta1
authorization.k8s.io/v1
authorization.k8s.io/v1beta1
autoscaling/v1
autoscaling/v2beta1
autoscaling/v2beta2
batch/v1
batch/v1beta1
batch/v2alpha1
certificates.k8s.io/v1beta1
coordination.k8s.io/v1
coordination.k8s.io/v1beta1
events.k8s.io/v1beta1
extensions/v1beta1
metrics.k8s.io/v1beta1
networking.k8s.io/v1
networking.k8s.io/v1beta1
policy/v1beta1
rbac.authorization.k8s.io/v1
rbac.authorization.k8s.io/v1beta1
scheduling.k8s.io/v1
scheduling.k8s.io/v1beta1
storage.k8s.io/v1
storage.k8s.io/v1beta1
v1
</code></pre>

<p>Kubernetes version:</p>

<pre><code>Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.5", GitCommit:"20c265fef0741dd71a66480e35bd69f18351daea", GitTreeState:"clean", BuildDate:"2019-10-15T19:16:51Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.11+IKS", GitCommit:"0562ba8a2dfdd05f7f8721ab4952c02fe1605860", GitTreeState:"clean", BuildDate:"2020-03-13T14:45:42Z", GoVersion:"go1.12.17", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

Ebubekir Tabak
<p>Newer IKS clusters don't have Docker installed - they use containerd to execute containers.</p>

<p>If you still want to execute Docker on Jenkins you can either use Kubernetes plugin and pods with <a href="https://hub.docker.com/_/docker" rel="nofollow noreferrer">dind</a> containers or rebuild your own jenkins based on dind - something like this: <a href="https://hub.docker.com/r/vixns/jenkins-dind/" rel="nofollow noreferrer">https://hub.docker.com/r/vixns/jenkins-dind/</a></p>
