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

tools-image: Clear /tmp contents as last step #441

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jepio
Copy link
Member

@jepio jepio commented Jun 26, 2024

/tmp in cloudshell has a whole bunch of leftover directories and files from the various installation steps that run during the build. Clear /tmp/ as the final step before finalizing the image. This doesn't make the image smaller because the files are still present in previous layers but makes the user experience better.

/tmp in cloudshell has a whole bunch of leftover directories and files
from the various installation steps that run during the build. Clear
/tmp/ as the final step before finalizing the image. This doesn't make
the image smaller because the files are still present in previous layers
but makes the user experience better.

Signed-off-by: Jeremi Piotrowski <[email protected]>
@@ -69,6 +69,8 @@ COPY ./linux/powershell/Invoke-PreparePowerShell.ps1 linux/powershell/Invoke-Pre

# Remove su so users don't have su access by default.
RUN rm -f ./linux/Dockerfile && rm -f /bin/su
# cleanup tmp files left behind by installation
RUN find /tmp/ -mindepth 1 -delete
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if we can clean up such stuff as soon as it is created in any RUN step? So there is no cruft in any layer.

As in this is a nice addition from security POV, but not from the size POV.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would love to, but the files seem to come many differents RUN steps, and it would make the dockerfile quite hard to read. Although i will check - maybe it's only a small number of RUN that need the cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants