LinuxCommandLibrary

docker-slim

optimize and reduce Docker image sizes

TLDR

Analyze and slim an image

$ docker-slim build [image]
copy
Profile an image
$ docker-slim profile [image]
copy
Lint a Dockerfile
$ docker-slim lint [Dockerfile]
copy
Generate Dockerfile from image
$ docker-slim xray [image]
copy
Slim with HTTP probes
$ docker-slim build --http-probe [image]
copy
Slim keeping shell access
$ docker-slim build --include-shell [image]
copy

SYNOPSIS

docker-slim command [options] [image]

DESCRIPTION

docker-slim (also known as SlimToolkit) analyzes and optimizes Docker images, reducing size significantly while maintaining functionality. Uses static and dynamic analysis. The tool works by executing the container, monitoring which files and dependencies are actually used, then creating a minimal image containing only those components. Can reduce image sizes by up to 30x while preserving application functionality.

PARAMETERS

--http-probe

Enable HTTP probing.
--include-shell
Include shell in slimmed image.
--target string
Target output image name.
--expose port
Expose additional ports.

SUBCOMMANDS

build

Analyze and create optimized image.
profile
Analyze image without building.
xray
Inspect image internals.
lint
Lint Dockerfile.
version
Show version info.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community