kaniko icon indicating copy to clipboard operation
kaniko copied to clipboard

not found error when add manifest-tool into kaniko

Open gaussye opened this issue 1 year ago • 2 comments

Actual behavior A clear and concise description of what the bug is.

I want to move the manifest-tool into kaniko for multi-arch build. However when i copied manifest-tool into kaniko image, the maniest-tool can not run.

Expected behavior A clear and concise description of what you expected to happen.

To Reproduce Steps to reproduce the behavior:

  1. Create a docker file: FROM --platform=$TARGETPLATFORM golang:1.20 AS builder RUN go install golang.org/x/tools/cmd/cover@latest
    && go install golang.org/x/lint/golint@latest ENV REGISTRY_COMMIT=a4d9db5a884b70be0c96dd6a7a9dbef4f2798c51 RUN set -x
    && mkdir -p /go/src/github.com && cd /go/src/github.com
    && git clone https://github.com/estesp/manifest-tool
    && cd manifest-tool && make binary FROM --platform=$TARGETPLATFORM gcr.io/kaniko-project/executor:debug COPY --from=builder /go/src/github.com/manifest-tool/manifest-tool /usr/local/bin

  2. build and push to docker docker buildx build --platform linux/arm64,linux/amd64 -t gaussye/kaniko-full . --push

  3. Run it on kubernetes: apiVersion: v1 kind: Pod metadata: name: kaniko spec: nodeSelector: containers:

    • name: kaniko image: gaussye/kaniko-full:latest command:
      • sleep args:
      • 99d restartPolicy: Never
  4. kubectl exec -it manifest-tool -n jenkins -- /bin/sh /kaniko # ls docker-credential-acr-env docker-credential-gcr manifest-tool warmer docker-credential-ecr-login executor ssl

run manifest-tool get not found error, however the manifest-tool is there. /kaniko # manifest-tool /bin/sh: manifest-tool: not found

Additional Information

  • Dockerfile Please provide either the Dockerfile you're trying to build or one that can reproduce this error.
  • Build Context Please provide or clearly describe any files needed to build the Dockerfile (ADD/COPY commands)
  • Kaniko Image (fully qualified with digest)

Triage Notes for the Maintainers

Description Yes/No
Please check if this a new feature you are proposing
  • - [ ]
Please check if the build works in docker but not in kaniko
  • - [ ]
Please check if this error is seen when you use --cache flag
  • - [ ]
Please check if your dockerfile is a multistage dockerfile
  • - [ ]

gaussye avatar Oct 13 '23 01:10 gaussye

Hi @gaussye, can you specify how you are trying to call manifest-tool? From the above it seems that manifest-tool might not be in the $PATH that you are using when attempting to call the tool.

Can you clarify, the manifest-tool that cannot be found is attempting to be called in a Dockerfile kaniko is building eg?:

...
RUN manifest-tool ...
...

Additionally can you provide/attempt the following to help us debug this:

  • The PATH env var being used in the container run
  • Attempt to use manifest-tool via a fully qualified path (/kaniko/manifest-tool) vs manifest-tool

aaron-prindle avatar Oct 20 '23 18:10 aaron-prindle

@gaussye did you fix it? I have the same error whatever I do

  • the binary exists in a directory
  • the directory is in the $PATH
  • which finds the binary
  • "no such file or directory" when we run it

This is all I do in a built image, not "RUN" inside the Dockerfile

other two errors:

/workspace # 
/workspace # /kaniko/manifest-tool
/bin/sh: /kaniko/manifest-tool: not found
/workspace # sh /kaniko/manifest-tool
/kaniko/manifest-tool: line 6: syntax error: unterminated quoted string

the binary exists in the kaniko dir

artemptushkin avatar Jan 04 '24 13:01 artemptushkin