K8s runner cannot build docker image

This is the error message returned by the drone-runner-kube

+ /usr/local/bin/dockerd --data-root /var/lib/docker --host=unix:///var/run/docker.sock --insecure-registry http://10.0.81.179:30050
Unable to reach Docker Daemon after 15 attempts.
Registry credentials or Docker config not provided. Guest mode enabled.
+ /usr/local/bin/docker version
Client:
 Version:           20.10.9
 API version:       1.41
 Go version:        go1.16.8
 Git commit:        c2ea9bc
 Built:             Mon Oct  4 16:03:22 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
exit status 1

drone.yml configuration

- name: build-image(dry)
    image: plugins/docker
    pull: if-not-exists
    volumes:
      - name: docker-cache
        path: /var/lib/docker
    settings:
#      username:
#        from_secret: docker_username
#      password:
#        from_secret: docker_secret
      dockerfile: build/Dockerfile
      repo: 10.0.81.179:30050/waf/${DRONE_REPO_NAME}
      registry: http://10.0.81.179:30050
      dry_run: true
      tags:
        - ${DRONE_BUILD_NUMBER}
    environment:
      PLUGIN_INSECURE: "true"

drone-runner-kube configuration

apiVersion: apps/v1
kind: Deployment
metadata:
  name: drone-runnerx
  namespace: drone
  labels:
    app.kubernetes.io/name: drone-runnerx
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: drone-runnerx
  template:
    metadata:
      labels:
        app.kubernetes.io/name: drone-runnerx
    spec:
      containers:
      - name: runner
        image: drone/drone-runner-kube:latest
        ports:
        - containerPort: 3000
        env:
        - name: DRONE_RPC_HOST
          value: drone-serverx
        - name: DRONE_RPC_PROTO
          value: http
        - name: DRONE_RPC_SECRET
          value: dronetest
        - name: DRONE_NAMESPACE_DEFAULT
          value: drone

I don’t know if it’s because I’m missing something, can you give me some help?

You cannot mount volumes when using the Docker plugin:

If you attempt to mount a volume into the plugin you will see the below entry in your pipeline logs. The docker plugin restricts mounting volumes for security reasons. This can be resolved by removing mounted volumes or by configuring the plugin step to run in privileged mode:

Source https://docs.drone.io/plugins/popular/docker/#using-volumes

I added privileges and even if I delete the volume, it still doesn’t work for me.

I found the problem, it is normal for me to run runner locally, but this problem exists on my ubuntu18, do I need to do some special configuration?

$ uname -a
Linux master-81-179 4.15.0-76-generic #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

sorry, I am not aware of any required configurations or known issues with the docker plugin. There is a section for common problems that you might want to have a look at, maybe something in that list would be applicable https://docs.drone.io/plugins/popular/docker/#common-problems

I have tested various versions of drone-runner-docker, 1.6.0 can run normally, and later versions (e.g. 1.8.0) will report this error, you can try to see if you can reproduce this problem

Can you give me some help?
Thans.
@brad

hi,Have you solved this problem?

plugins/docker cannot be used in k8s, but can only be run in docker.

Can we look at this problem together?
https://drone.discourse.group/t/docker-dind-not-work-in-k8s/13428