This repository was archived by the owner on Jun 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
This repository was archived by the owner on Jun 3, 2025. It is now read-only.
Kaniko ADD instruction not preserve permissions via chmod argument #2850
Copy link
Copy link
Closed
Labels
area/permissionscmd/adddiffers-from-dockerissue/chmodkind/bugSomething isn't workingSomething isn't working
Description
Actual behavior
ADD Dockerfile instruction not preserve permissions with chmod argument usage.
Expected behavior
ADD Dockerfile instruction with chmod argument preserve permissions
To Reproduce
Steps to reproduce the behavior:
- Build Dockerfile:
FROM alpine:latest
ADD --chmod=0755 https://github.com/GoogleContainerTools/kaniko/blob/main/benchmark.sh /usr/local/bin
# Check permissions
RUN ls -al /usr/local/bin/
- Get output:
/workspace # executor -c . --no-push
INFO[0000] Retrieving image manifest alpine:latest
INFO[0000] Retrieving image alpine:latest from registry index.docker.io
INFO[0022] Built cross stage deps: map[]
INFO[0022] Retrieving image manifest alpine:latest
INFO[0022] Returning cached image manifest
INFO[0022] Executing 0 build triggers
INFO[0022] Building stage 'alpine:latest' [idx: '0', base-idx: '-1']
INFO[0022] Unpacking rootfs as cmd ADD --chmod=0755 https://github.com/GoogleContainerTools/kaniko/blob/main/benchmark.sh /usr/local/bin requires it.
INFO[0027] Using files from context: []
INFO[0027] ADD --chmod=0755 https://github.com/GoogleContainerTools/kaniko/blob/main/benchmark.sh /usr/local/bin
INFO[0027] Adding remote URL https://github.com/GoogleContainerTools/kaniko/blob/main/benchmark.sh to /usr/local/bin/benchmark.sh
INFO[0033] Taking snapshot of files...
INFO[0033] RUN ls -al /usr/local/bin/
INFO[0033] Initializing snapshotter ...
INFO[0033] Taking snapshot of full filesystem...
INFO[0033] Cmd: /bin/sh
INFO[0033] Args: [-c ls -al /usr/local/bin/]
INFO[0033] Running: [/bin/sh -c ls -al /usr/local/bin/]
total 124
drwxr-xr-x 1 root root 24 Nov 13 13:56 .
drwxr-xr-x 1 root root 22 Nov 13 13:56 ..
-rw------- 1 root root 126793 Nov 13 13:56 benchmark.sh
INFO[0033] Taking snapshot of full filesystem...
INFO[0033] No files were changed, appending empty layer to config. No layer added to image.
INFO[0033] Skipping push to container registry due to --no-push flag
- File have permissions 0600, but must have 0755
Additional Information
- Dockerfile
FROM alpine:latest
ADD --chmod=0755 https://github.com/GoogleContainerTools/kaniko/blob/main/benchmark.sh /usr/local/bin
RUN ls -al /usr/local/bin/
- Build Context
Directory with Dockerfile above only
File from ADD instruction - https://github.com/GoogleContainerTools/kaniko/blob/main/benchmark.sh - Kaniko Image gcr.io/kaniko-project/executor:v1.18.0-debug
- I not see any chmod operations and set permissions, only chown operation in source file https://github.com/GoogleContainerTools/kaniko/blob/main/pkg/commands/add.go
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 |
|
trombonax, Galkree, Tikondra, indistinctTalk, willywanka75 and 3 moreGalkree and TikondraTikondra
Metadata
Metadata
Assignees
Labels
area/permissionscmd/adddiffers-from-dockerissue/chmodkind/bugSomething isn't workingSomething isn't working