kaniko
kaniko copied to clipboard
built image lost 'RUN mkdir -p /tmp' layer.
Actual behavior A clear and concise description of what the bug is. Dockerfile:
FROM gcr.io/kaniko-project/executor:v1.17.0-debug
RUN mkdir -p /tmp
The /tmp directory is missing in the built image which is created by 'RUN mkdir -p /tmp'.
Expected behavior A clear and concise description of what you expected to happen. keep "/tmp" directory and 'RUN mkdir -p /tmp' layer. To Reproduce Steps to reproduce the behavior:
- build image
/kaniko/executor \
--context=. \
--dockerfile=Dockerfile \
--insecure-pull
--destination=${destination_image}
- run container
docker run -it --rm --entrypoint /busybox/ls ${destination_image} -l /
Additional Information
- Dockerfile FROM gcr.io/kaniko-project/executor:v1.17.0-debug
RUN mkdir -p /tmp
- 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 |
|
Thanks for the issue @zhuoshaojian . Would you mind inputs more what are the usage for the mkdir
and if it would be used in a multi-stage build? This might be a possible dupe of https://github.com/GoogleContainerTools/kaniko/issues/2764.
When I try to create an empty directory, I encounter the same issue.
When I try to create an empty directory, I encounter the same issue.
Would you mind help provide the inputs/ dockerfile ?
@yunwuxin you tried make dir in /var/run
this dir will be ignored.
just run build with arg -v debug
and you will see message Not adding /var/run because it is ignored
and another ignored dirs
@zhuoshaojian, I can't reproduce the problem.
$ cat Dockerfile
FROM gcr.io/kaniko-project/executor:v1.17.0-debug
RUN mkdir -p /tmp
$ podman run --rm -it --net host --name kaniko_test -v "$(pwd):/workspace/" gcr.io/kaniko-project/executor:v1.17.0-debug --insecure --insecure-pull --destination 127.0.0.1:5000/test:tmp
INFO[0000] Retrieving image manifest gcr.io/kaniko-project/executor:v1.17.0-debug
INFO[0000] Retrieving image gcr.io/kaniko-project/executor:v1.17.0-debug from registry gcr.io
INFO[0001] Built cross stage deps: map[]
INFO[0001] Retrieving image manifest gcr.io/kaniko-project/executor:v1.17.0-debug
INFO[0001] Returning cached image manifest
INFO[0001] Executing 0 build triggers
INFO[0001] Building stage 'gcr.io/kaniko-project/executor:v1.17.0-debug' [idx: '0', base-idx: '-1']
INFO[0001] Unpacking rootfs as cmd RUN mkdir -p /tmp requires it.
INFO[0008] RUN mkdir -p /tmp
INFO[0008] Initializing snapshotter ...
INFO[0008] Taking snapshot of full filesystem...
INFO[0008] Cmd: /bin/sh
INFO[0008] Args: [-c mkdir -p /tmp]
INFO[0008] Running: [/bin/sh -c mkdir -p /tmp]
INFO[0008] Taking snapshot of full filesystem...
INFO[0008] Pushing image to 127.0.0.1:5000/test:tmp
INFO[0008] Pushed 127.0.0.1:5000/test@sha256:e166240eddb1d684aa6297538d42452e296a4ff3d0bb3e74fe31f8a88864b1b6
$ podman run -it --rm --entrypoint /busybox/ls localhost:5000/test:tmp /
bin busybox dev etc kaniko proc run sys tmp workspace
$ podman run --rm -it --net host --name kaniko_test -v "$(pwd):/workspace/" gcr.io/kaniko-project/executor:latest --insecure --insecure-pull --destination 127.0.0.1:5000/test:tmp2
INFO[0000] Retrieving image manifest gcr.io/kaniko-project/executor:v1.17.0-debug
INFO[0000] Retrieving image gcr.io/kaniko-project/executor:v1.17.0-debug from registry gcr.io
INFO[0001] Built cross stage deps: map[]
INFO[0001] Retrieving image manifest gcr.io/kaniko-project/executor:v1.17.0-debug
INFO[0001] Returning cached image manifest
INFO[0001] Executing 0 build triggers
INFO[0001] Building stage 'gcr.io/kaniko-project/executor:v1.17.0-debug' [idx: '0', base-idx: '-1']
INFO[0001] Unpacking rootfs as cmd RUN mkdir -p /tmp requires it.
INFO[0007] RUN mkdir -p /tmp
INFO[0007] Initializing snapshotter ...
INFO[0007] Taking snapshot of full filesystem...
INFO[0007] Cmd: /bin/sh
INFO[0007] Args: [-c mkdir -p /tmp]
INFO[0007] Running: [/bin/sh -c mkdir -p /tmp]
INFO[0007] Taking snapshot of full filesystem...
INFO[0008] Pushing image to 127.0.0.1:5000/test:tmp2
INFO[0008] Pushed 127.0.0.1:5000/test@sha256:2b529a32a066cc48509d231f9c1b47033c90e24e33fd4ea6f09352177011ed4f
$ podman run -it --rm --entrypoint /busybox/ls localhost:5000/test:tmp2 /
bin busybox dev etc kaniko proc run sys tmp workspace
Can you copy all your steps (cat dockerfile, run docker container, another commands) from console here or pastebin.