kaniko icon indicating copy to clipboard operation
kaniko copied to clipboard

mktemp present but non-functional

Open BeyondEvil opened this issue 1 year ago • 3 comments

Actual behavior mktemp is present in the image with execution bit set, but is non-functional:

mktemp: No such file or directory

Expected behavior mktemp should work (or possibly be removed).

To Reproduce Steps to reproduce the behavior:

❯ docker run -ti --rm --entrypoint "/bin/sh" gcr.io/kaniko-project/executor:v1.21.1-debug -c 'ls -la /busybox | grep mktemp'
-rwxr-xr-x  398 0        0          1312536 May 18  2023 mktemp

❯ docker run -ti --rm --entrypoint mktemp gcr.io/kaniko-project/executor:v1.21.1-debug                                      
mktemp: No such file or directory

❯ docker run -ti --rm --entrypoint "/busybox/mktemp" gcr.io/kaniko-project/executor:v1.21.1-debug                         
mktemp: No such file or directory

Additional Information Digest: gcr.io/kaniko-project/executor@sha256:0818d281f155b9bb1b1f0704e55939b9c440b0155cbbf65b567ca19e19e20223

My system:

MacBook Pro M2 Max (Sonoma 14.2.1 (23C71))

❯ docker version                                             
Client:
 Cloud integration: v1.0.35+desktop.5
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.20.7
 Git commit:        ed223bc
 Built:             Mon Sep  4 12:28:49 2023
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.24.2 (124339)
 Engine:
  Version:          24.0.6
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.7
  Git commit:       1a79695
  Built:            Mon Sep  4 12:31:36 2023
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.22
  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
 runc:
  Version:          1.1.8
  GitCommit:        v1.1.8-0-g82f18fe
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Triage Notes for the Maintainers

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

BeyondEvil avatar Apr 08 '24 22:04 BeyondEvil

Thanks for filing this @BeyondEvil , would you mind indicating which version of kaniko image are you using and could you try on previous release to find if this is a regression?

Also may I check with you why mktemp is regarded as present?

JeromeJu avatar Apr 11 '24 15:04 JeromeJu

Thanks for filing this @BeyondEvil , would you mind indicating which version of kaniko image are you using and could you try on previous release to find if this is a regression?

Version is v1.21.1-debug.

Sure, I'll do a regression test and get back to you.

Also may I check with you why mktemp is regarded as present?

Because ls -la lists it:

❯ docker run -ti --rm --entrypoint "/bin/sh" gcr.io/kaniko-project/executor:v1.21.1-debug -c 'ls -la /busybox | grep mktemp'
-rwxr-xr-x  398 0        0          1312536 May 18  2023 mktemp

BeyondEvil avatar Apr 11 '24 15:04 BeyondEvil

I've faced the same problem and this is my solution.

If no arguments are provided to mktemp it tries to create files at /tmp which does not exist in the kaniko container.

Create /tmp

# mktemp
mktemp: No such file or directory
# mkdir /tmp
# mktemp
/tmp/tmp.ieAGKD

Or

use

mktemp -p /existing_directory

Should work.

Having mktemp work out of the box by providing a /tmp folder would be a good thing.

ahollmann avatar Apr 20 '24 06:04 ahollmann