Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
fc0da61f
Commit
fc0da61f
authored
Jun 05, 2020
by
mo khan
Committed by
Nick Gaskill
Jun 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide guidance on techniques for shrinking docker image sizes
parent
82e21e6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
+19
-3
doc/development/integrations/secure.md
doc/development/integrations/secure.md
+19
-3
No files found.
doc/development/integrations/secure.md
View file @
fc0da61f
...
...
@@ -124,9 +124,9 @@ regardless of the individual machine the scanner runs on.
Depending on the CI infrastructure,
the CI may have to fetch the Docker image every time the job runs.
To make the scanning job run fast, and to avoid wasting bandwidth,
it is important to make Docker images as small as possible
,
ideally smaller than 50 MB
.
For the scanning job to run fast and avoid wasting bandwidth, Docker images should be as small as
possible. You should aim for 50MB or smaller. If that isn't possible, try to keep it below 1.46 GB
,
which is the size of a CD-ROM
.
If the scanner requires a fully functional Linux environment,
it is recommended to use a
[
Debian
](
https://www.debian.org/intro/about
)
"slim" distribution or
[
Alpine Linux
](
https://www.alpinelinux.org/
)
.
...
...
@@ -135,6 +135,22 @@ and to compile the scanner with all the libraries it needs.
[
Multi-stage builds
](
https://docs.docker.com/develop/develop-images/multistage-build/
)
might also help with keeping the image small.
To keep an image size small, consider using
[
dive
](
https://github.com/wagoodman/dive#dive
)
to analyze layers in a Docker image to
identify where additional bloat might be originating from.
In some cases, it might be difficult to remove files from an image. When this occurs, consider using
[
Zstandard
](
https://github.com/facebook/zstd
)
to compress files or large directories. Zstandard offers many different compression levels that can
decrease the size of your image with very little impact to decompression speed. It may be helpful to
automatically decompress any compressed directories as soon as an image launches. You can accomplish
this by adding a step to the Docker image's
`/etc/bashrc`
or to a specific user's
`$HOME/.bashrc`
.
Remember to change the entry point to launch a bash login shell if you chose the latter option.
Here are some examples to get you started:
-
<https://gitlab.com/gitlab-org/security-products/license-management/-/blob/0b976fcffe0a9b8e80587adb076bcdf279c9331c/config/install.sh#L168-170>
-
<https://gitlab.com/gitlab-org/security-products/license-management/-/blob/0b976fcffe0a9b8e80587adb076bcdf279c9331c/config/.bashrc#L49>
### Image tag
As documented in the
[
Docker Official Images
](
https://github.com/docker-library/official-images#tags-and-aliases
)
project,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment