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

ADD or COPY a file to a directory will lead directory to losing permissions. #721

Closed
drpmma opened this issue Jul 23, 2019 · 3 comments
Closed
Assignees
Labels
area/dockerfile-command For all bugs related to dockerfile file commands cmd/add cmd/copy fixed-needs-verfication kind/bug Something isn't working priority/p1 Basic need feature compatibility with docker build. we should be working on this next.

Comments

@drpmma
Copy link

drpmma commented Jul 23, 2019

Actual behavior
Directory permission will be changed when ADD or COPY a file to it.

I ADD a test.txt to the directory /tmp, the permission is changed from 1777 to 0755.

It's similar to #647.

  • the original image's directory permission
total 56
drwxr-xr-x    2 root     root          4096 Jul 11 17:29 bin
drwxr-xr-x    5 root     root           340 Jul 23 08:32 dev
drwxr-xr-x    1 root     root          4096 Jul 23 08:32 etc
drwxr-xr-x    2 root     root          4096 Jul 11 17:29 home
drwxr-xr-x    5 root     root          4096 Jul 11 17:29 lib
drwxr-xr-x    5 root     root          4096 Jul 11 17:29 media
drwxr-xr-x    2 root     root          4096 Jul 11 17:29 mnt
drwxr-xr-x    2 root     root          4096 Jul 11 17:29 opt
dr-xr-xr-x  478 root     root             0 Jul 23 08:32 proc
drwx------    2 root     root          4096 Jul 11 17:29 root
drwxr-xr-x    2 root     root          4096 Jul 11 17:29 run
drwxr-xr-x    2 root     root          4096 Jul 11 17:29 sbin
drwxr-xr-x    2 root     root          4096 Jul 11 17:29 srv
dr-xr-xr-x   13 root     root             0 Jun 27 06:44 sys
drwxrwxrwt    2 root     root          4096 Jul 11 17:29 tmp
drwxr-xr-x    7 root     root          4096 Jul 11 17:29 usr
drwxr-xr-x   11 root     root          4096 Jul 11 17:29 var
  • the build image's directory permission
total 56
drwxr-xr-x    2 root     root          4096 Jul 11 17:29 bin
drwxr-xr-x    5 root     root           340 Jul 23 08:33 dev
drwxr-xr-x    1 root     root          4096 Jul 23 08:33 etc
drwxr-xr-x    2 root     root          4096 Jul 11 17:29 home
drwxr-xr-x    5 root     root          4096 Jul 11 17:29 lib
drwxr-xr-x    5 root     root          4096 Jul 11 17:29 media
drwxr-xr-x    2 root     root          4096 Jul 11 17:29 mnt
drwxr-xr-x    2 root     root          4096 Jul 11 17:29 opt
dr-xr-xr-x  482 root     root             0 Jul 23 08:33 proc
drwx------    2 root     root          4096 Jul 11 17:29 root
drwxr-xr-x    2 root     root          4096 Jul 11 17:29 run
drwxr-xr-x    2 root     root          4096 Jul 11 17:29 sbin
drwxr-xr-x    2 root     root          4096 Jul 11 17:29 srv
dr-xr-xr-x   13 root     root             0 Jun 27 06:44 sys
drwxr-xr-x    1 root     root          4096 Jul 23 08:30 tmp
drwxr-xr-x    7 root     root          4096 Jul 11 17:29 usr
drwxr-xr-x   11 root     root          4096 Jul 11 17:29 var

Expected behavior
The directory permission should remain the same.

To Reproduce
build the Dockerfile below with kaniko

Additional Information

  • Dockerfile
FROM alpine

ADD test.txt /tmp/
  • Kaniko Image v0.10.0
@tejal29 tejal29 added kind/bug Something isn't working cmd/add cmd/copy labels Aug 9, 2019
@tejal29 tejal29 added the priority/p1 Basic need feature compatibility with docker build. we should be working on this next. label Sep 13, 2019
@tejal29 tejal29 added the area/dockerfile-command For all bugs related to dockerfile file commands label Sep 27, 2019
@cvgw cvgw added this to the GA Release v1.0.0 milestone Jan 10, 2020
@cvgw
Copy link
Contributor

cvgw commented Jan 10, 2020

I think this will also be fixed by #961

cgwippern@cgwippern:~/kaniko-dev/issues/721$ docker run -it --rm alpine /bin/sh
/ # ls -l /
total 56
drwxr-xr-x    2 root     root          4096 Dec 19 15:20 bin
drwxr-xr-x    5 root     root           360 Jan 10 21:22 dev
drwxr-xr-x    1 root     root          4096 Jan 10 21:22 etc
drwxr-xr-x    2 root     root          4096 Dec 19 15:20 home
drwxr-xr-x    5 root     root          4096 Dec 19 15:20 lib
drwxr-xr-x    5 root     root          4096 Dec 19 15:20 media
drwxr-xr-x    2 root     root          4096 Dec 19 15:20 mnt
drwxr-xr-x    2 root     root          4096 Dec 19 15:20 opt
dr-xr-xr-x  471 root     root             0 Jan 10 21:22 proc
drwx------    1 root     root          4096 Jan 10 21:22 root
drwxr-xr-x    2 root     root          4096 Dec 19 15:20 run
drwxr-xr-x    2 root     root          4096 Dec 19 15:20 sbin
drwxr-xr-x    2 root     root          4096 Dec 19 15:20 srv
dr-xr-xr-x   13 root     root             0 Jan 10 21:22 sys
drwxrwxrwt    2 root     root          4096 Dec 19 15:20 tmp
drwxr-xr-x    7 root     root          4096 Dec 19 15:20 usr
drwxr-xr-x   12 root     root          4096 Dec 19 15:20 var
/ # exit
cgwippern@cgwippern:~/kaniko-dev/issues/721$ docker run -it --rm gcr.io/kaniko-dev/issues:721-kaniko-v1 ls -l /
total 56
drwxr-xr-x    2 root     root          4096 Dec 24 15:04 bin
drwxr-xr-x    5 root     root           360 Jan 10 21:22 dev
drwxr-xr-x    1 root     root          4096 Jan 10 21:22 etc
drwxr-xr-x    2 root     root          4096 Dec 24 15:04 home
drwxr-xr-x    5 root     root          4096 Dec 24 15:04 lib
drwxr-xr-x    5 root     root          4096 Dec 24 15:04 media
drwxr-xr-x    2 root     root          4096 Dec 24 15:04 mnt
drwxr-xr-x    2 root     root          4096 Dec 24 15:04 opt
dr-xr-xr-x  470 root     root             0 Jan 10 21:22 proc
drwx------    2 root     root          4096 Dec 24 15:04 root
drwxr-xr-x    2 root     root          4096 Dec 24 15:04 run
drwxr-xr-x    2 root     root          4096 Dec 24 15:04 sbin
drwxr-xr-x    2 root     root          4096 Dec 24 15:04 srv
dr-xr-xr-x   13 root     root             0 Jan 10 21:22 sys
drwxrwxrwt    1 root     root          4096 Jan 10 21:20 tmp
drwxr-xr-x    7 root     root          4096 Dec 24 15:04 usr
drwxr-xr-x   12 root     root          4096 Dec 24 15:04 var

@cvgw
Copy link
Contributor

cvgw commented Feb 4, 2020

@drpmma would you mind checking with the latest version of kaniko to see if this bug is fixed. Thanks!

@tejal29
Copy link
Member

tejal29 commented Feb 28, 2020

This is fixed by #961 and manually verified.
Please re-open if you this issue again.

Thank you!

@tejal29 tejal29 closed this as completed Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dockerfile-command For all bugs related to dockerfile file commands cmd/add cmd/copy fixed-needs-verfication kind/bug Something isn't working priority/p1 Basic need feature compatibility with docker build. we should be working on this next.
Projects
None yet
Development

No branches or pull requests

3 participants