Run strip-docker-image as a user with a different UID from the default user for the given source image (the latter is usually root)
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.
Step to reproduce:
strip-docker-image
as a user with a different UID from the default user for the given source image (the latter is usuallyroot
)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.)