I encountered an issue while deploying Drone using pipeline in k8s

Hello all,My example is compiling a Vue project and building it into a Docker image, then publishing it to a remote image repository. When I used the plugins/docker plugin, it prompted the following error:

+ /usr/local/bin/dockerd --data-root /var/lib/docker --host=unix:///var/run/docker.sock
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.14
 API version:       1.41
 Go version:        go1.16.15
 Git commit:        a224086
 Built:             Thu Mar 24 01:45:09 2022
 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

Here is my YAML code:

kind: pipeline
type: kubernetes
name: default
steps:
  - name: build
    image: node:14
    volumes:
      - name: build
        path: /app/build
    commands:
      - npm config set registry http://registry.npm.taobao.org
      - export CHROMEDRIVER_CDNURL=https://npm.taobao.org/mirrors/chromedriver
      - npm install
      - npm run build
    when:
      event:
        - push
      branch:
        - master
  - name: upload-to-acr
    image: plugins/docker
    volumes:
      - name: build
        path: /app/build
    settings:
      username:
        from_secret: XXXX
      password:
        from_secret: XXXX
      repo: registry.cn-hangzhou.aliyuncs.com/lsl-testresp/drone_test_resp
      tags: v${DRONE_BUILD_NUMBER}
      purge: true
    when:
      event:
        - push
        - tag
volumes: 
  - name: build
    host:
      path: /home/docker/drone/build 
trigger:
  event:
    - push
    - pull_request
    - rollback
    - custom

please tell me what the problem is? Or can you provide an example of packaging a Vue project into a Docker image?

One issue probably is that you’re using the deprecated Kubernetes runner but I’m in the same boat. dind will not wanna work at all.

Is there the latest runner that can be used in k8s? I just know that there is no official runtime in k8s :face_with_spiral_eyes:

Can you help me to have a look? tks

It’s worth noting that the Drone Kubernetes runner is now deprecated. Instead, you should use the Docker runner for executing Docker-based pipelines in Kubernetes. A Helm chart for the Docker runner is available here: charts/charts/drone-runner-docker at master · drone/charts · GitHub.

To help you get started, I’ve included a sample YAML for building using the Docker runner:

kind: pipeline
name: build-container-amd64

platform:
  os: linux
  arch: amd64


# Define the steps of the pipeline
steps:
  - name: build-amd64
    image: plugins/docker
    settings:
      username:
        from_secret: REGISTRY_USER
      password:
        from_secret: REGISTRY_PASSWORD
      registry: git.<snip>.fi
      repo: git.<snip>.fi/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}
      tags:
        - latest-amd64

If you found this information helpful, please consider making a donation to support my continued work. Your donation will help cover the costs of researching and creating new resources, and will allow me to devote more time and resources to providing useful content. A donation of €5-€10 would be greatly appreciated, but any amount helps. Thank you for your support! Donate at: BuyMeCoffee