Docker:dind not work in k8s

error:

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

my pipeline:

---
kind: pipeline
type: kubernetes
name: default

steps:
- name: test
  image: docker:dind
  volumes:
  - name: dockersock
    path: /var/run
  commands:
  - sleep 5 # give docker enough time to start
  - docker ps -a

services:
- name: docker
  image: docker:dind
  privileged: true
  volumes:
  - name: dockersock
    path: /var/run

volumes:
- name: dockersock
  host:
    path: /var/run/

my k8s runner:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations: {}
  labels:
    k8s.kuboard.cn/name: my-drone-runner
  name: my-drone-runner
  namespace: tools
  resourceVersion: '12813'
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      k8s.kuboard.cn/name: my-drone-runner
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      annotations:
        kubectl.kubernetes.io/restartedAt: '2023-02-17T00:25:25+08:00'
      creationTimestamp: null
      labels:
        k8s.kuboard.cn/name: my-drone-runner
    spec:
      containers:
        - envFrom:
            - configMapRef:
                name: drone-runner
          image: drone/drone-runner-kube
          imagePullPolicy: IfNotPresent
          name: mydronerunner
          resources: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status:
  availableReplicas: 1
  conditions:
    - lastTransitionTime: '2023-02-16T16:20:25Z'
      lastUpdateTime: '2023-02-16T16:20:25Z'
      message: Deployment has minimum availability.
      reason: MinimumReplicasAvailable
      status: 'True'
      type: Available
    - lastTransitionTime: '2023-02-16T14:18:31Z'
      lastUpdateTime: '2023-02-16T16:25:26Z'
      message: ReplicaSet "my-drone-runner-78cd884448" has successfully progressed.
      reason: NewReplicaSetAvailable
      status: 'True'
      type: Progressing
  observedGeneration: 8
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1


Can someone help me to have a look? :face_with_spiral_eyes:

Hi @Bluebang

Can you try adding the below to service section:.

command: ["dockerd", "--host=unix:///var/run/docker.sock"]

I solved it using the meditation library plugins/docker. :smiley:

By the way, do you have any problems with signatures? :rofl: