Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-build task fails with exec format error #5233

Closed
TomHart opened this issue Jul 28, 2022 · 11 comments
Closed

docker-build task fails with exec format error #5233

TomHart opened this issue Jul 28, 2022 · 11 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@TomHart
Copy link

TomHart commented Jul 28, 2022

Expected Behavior

Able to build a docker image

Actual Behavior

Fails to run
docker-build step fails with

2022/07/28 16:45:50 Error executing command: fork/exec /tekton/scripts/script-0-6znlv: exec format error

Steps to Reproduce the Problem

Additional Info

  • Kubernetes version:

    Output of kubectl version:

    Client Version: v1.24.1
    Kustomize Version: v4.5.4
    Server Version: v1.24.3+k3s1
    
  • Tekton Pipeline version:

    Output of tkn version or kubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'

    v0.38.0
    

Pipeline YAML

apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
    name: docker-build-push
    namespace: tekton-pipelines
spec:
    description: |
        This pipeline clones a git repo, builds a docker file, and pushed the image to a registry.
    params:
        -   name: repo-url
            type: string
            description: The git repo URL to clone from.
        -   name: image-name
            type: string
            description: The name of the docker image to build including tag
    workspaces:
        -   name: shared-data
            description: |
                This workspace contains the cloned repo files, so they can be read by the
                next task.
        -   name: git-credentials
            description: SSH credentials
    tasks:
        -   name: fetch-source
            taskRef:
                name: git-clone
            workspaces:
                -   name: output
                    workspace: shared-data
                -   name: ssh-directory
                    workspace: git-credentials
            params:
                -   name: url
                    value: $(params.repo-url)

        -   name: build-and-push
            runAfter: [ "fetch-source" ]
            taskRef:
                name: docker-build
            workspaces:
                -   name: source
                    workspace: shared-data
            params:
                -   name: image
                    value: $(params.image-name)

Pipeline Run YAML

apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
    name: my-app-name
    namespace: tekton-pipelines
spec:
    pipelineRef:
        name: docker-build-push
    workspaces:
        -   name: shared-data
            volumeClaimTemplate:
                spec:
                    accessModes:
                        - ReadWriteOnce
                    resources:
                        requests:
                            storage: 256Mi
        -   name: git-credentials
            secret:
                secretName: git-credentials
    params:
        -   name: repo-url
            value: git@github.com:my_repo.git
        -   name: image-name
            value: my.personal.registry/test-app:tekton
@TomHart TomHart added the kind/bug Categorizes issue or PR as related to a bug. label Jul 28, 2022
@imjasonh
Copy link
Member

That error typically means that the image was built for a different architecture than the one it's running on.

In this case, the image currently defined in docker-build is docker.io/library/docker:stable@sha256:18ff92d3d31725b53fa6633d60bed323effb6d5d4588be7b547078d384e0d4bf

https://github.com/tektoncd/catalog/blob/5e1f510bb47020585cb8277adc4ad903b2aaa8ba/task/docker-build/0.1/docker-build.yaml#L24

This digest points to the single-platform image for linux/amd64, despite the fact that docker.io/library/docker:stable is a multi-platform image that includes support for arm64 and arm/v6 and arm/v7.

I'd recommend specifying a builder_image parameter to the task that references the multi-platform docker:stable image. That reference by digest is currently:

docker.io/library/docker:stable@sha256:fd4d028713fd05a1fb896412805daed82c4a0cc84331d8dad00cb596d7ce3e3a

@TomHart
Copy link
Author

TomHart commented Jul 28, 2022

That makes sense, my k3s cluster and Tekton is running on a Raspberry Pi 4, I'm trying a build now just referencing stable, no digest, but if that doesn't work I'll try yours next

@TomHart
Copy link
Author

TomHart commented Jul 28, 2022

I tried both, which had different errors
No digest:

time="2022-07-28T17:01:44Z" level=error msg="failed to dial gRPC: cannot connect to the Docker daemon. Is 'docker daemon' running on this host?: dial tcp [::1]:2376: connect: connection refused"
error during connect: Post https://localhost:2376/v1.40/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&nocache=1&rm=1&session=shfltfrxsduh4usxr002hoa90&shmsize=0&t=%2Ftest-app%3Atekton&target=&ulimits=null&version=1: context canceled

The digest you posted

error during connect: Post https://localhost:2376/v1.40/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&nocache=1&rm=1&session=v4gyz9xd46jb4q6wd1wp91g8u&shmsize=0&t=%2Ftest-app%3Atekton&target=&ulimits=null&version=1: read tcp [::1]:56922->[::1]:2376: read: connection reset by peer

@imjasonh
Copy link
Member

This sounds like another issue, possibly related to tektoncd/catalog#628

@tekton-robot
Copy link
Collaborator

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale with a justification.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 26, 2022
@tekton-robot
Copy link
Collaborator

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten with a justification.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle rotten

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Nov 25, 2022
@tekton-robot
Copy link
Collaborator

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen with a justification.
Mark the issue as fresh with /remove-lifecycle rotten with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/close

Send feedback to tektoncd/plumbing.

@tekton-robot
Copy link
Collaborator

@tekton-robot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen with a justification.
Mark the issue as fresh with /remove-lifecycle rotten with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/close

Send feedback to tektoncd/plumbing.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ryanotella
Copy link

Building on a Mac M1 will cause this problem. Use docker build --platform linux/amd64 ...

@woodcockjosh
Copy link

/reopen

@tekton-robot
Copy link
Collaborator

@woodcockjosh: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
Status: Done
Development

No branches or pull requests

5 participants