pipeline: fork/exec /busybox/mkdir: exec format error

kubectl version

Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.1", GitCommit:"5e58841cce77d4bc13713ad2b91fa0d961e69192", GitTreeState:"clean", BuildDate:"2021-05-12T14:11:29Z", GoVersion:"go1.16.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.1", GitCommit:"5e58841cce77d4bc13713ad2b91fa0d961e69192", GitTreeState:"clean", BuildDate:"2021-05-21T23:06:30Z", GoVersion:"go1.16.4", Compiler:"gc", Platform:"linux/arm64"}

tkn version

Client version: 0.20.0
Pipeline version: v0.28.0

I am just trying to get src from public github and build to gcr.io

Dockerfile: FROM nginx:1.21.1-alpine

I have a valid ServiceAccount setup as “tutorial-service”

Error:

 kubectl -n default logs build-docker-image-webapp-image-pod-gxmhl -c step-create-dir-builtimage-4xb74
2021/09/20 19:34:57 Error executing command: fork/exec /busybox/mkdir: exec format error

PipelineResource: webapp-src

apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
  name: webapp-src
spec:
  type: git
  params:
    - name: revision
      value: main
    - name: url
      value: https://github.com/<organization>/webapp.git

PipelineResource: webapp-image

apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
  name: webapp-image
spec:
  type: image
  params:
    - name: url
      value: gcr.io/<myproject>/webapp

Task: build-docker-image-from-git-source

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: build-docker-image-from-git-source
spec:
  params:
    - name: pathToDockerFile
      type: string
      description: The path to the dockerfile to build
      default: $(resources.inputs.docker-source.path)/Dockerfile
    - name: pathToContext
      type: string
      description: |
        The build context used by Kaniko
        (https://github.com/GoogleContainerTools/kaniko#kaniko-build-contexts)
      default: $(resources.inputs.docker-source.path)
  resources:
    inputs:
      - name: docker-source
        type: git
    outputs:
      - name: builtImage
        type: image
  steps:
    - name: build-and-push
      image: gcr.io/kaniko-project/executor:arm64
      # specifying DOCKER_CONFIG is required to allow kaniko to detect docker credential
      env:
        - name: "DOCKER_CONFIG"
          value: "/tekton/home/.docker/"
      command:
        - /kaniko/executor
      args:
        - --dockerfile=$(params.pathToDockerFile)
        - --destination=$(resources.outputs.builtImage.url)
        - --context=$(params.pathToContext)
        - --customPlatform=linux/arm64

TaskRun: tekton.dev/v1beta1

apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: build-docker-image-webapp-image
spec:
  serviceAccountName: tutorial-service
  taskRef:
    name: build-docker-image-from-git-source
  params:
    - name: pathToDockerFile
      value: Dockerfile
  resources:
    inputs:
      - name: docker-source
        resourceRef:
          name: webapp-src
    outputs:
      - name: builtImage
        resourceRef:
          name: webapp-image

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Can you try editing the controller deployment to manually select exactly the linux/arm64 shell-image, instead of relying on selecting the platform-specific image from the multi-arch image shipped by Tekton?

$ kubectl edit deployment tekton-pipelines-controller -n tekton-pipelines

and change

        - -shell-image
        - gcr.io/distroless/base@sha256:aa4fd987555ea10e1a4ec8765da8158b5ffdfef1e72da512c7ede509bc9966c4

to

        - -shell-image
        - gcr.io/distroless/base@sha256:3a20a2d87752fd6b60ec52227aaedb036c01681b0abac4ec3901554634bc4a65

then run the TaskRun and see if it works?