mvanholsteijn / strip-docker-image

Utility to strip Docker images to their bare minimum size.
Apache License 2.0
339 stars 42 forks source link

Final line in strip-docker-image fails if not run as root #9

Open steven-collins-omega opened 7 years ago

steven-collins-omega commented 7 years ago

Step to reproduce:

Expected behavior: the script completes successfully, deleting the temporary export directory it creates.

Actual behavior: the final line of the script, rm -rf $DIR, fails due to a Permission denied error, thus failing to remove the directory. This also results in the script as a whole exiting with a non-zero error code.

(I realize that permissions in Docker shared volumes are tricky and that this is not trivial to solve cleanly and transparently. https://denibertovic.com/posts/handling-permissions-with-docker-volumes/ points to a possible solution, but it's a lot of hoops to jump through.)