docker-slim

optimize and reduce Docker image sizes

TLDR

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

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.

INSTALL

brew install docker-slim
nix profile install nixpkgs#docker-slim

SEE ALSO

docker-build(1), docker-images(1)

RESOURCES

Source code · Homepage