← 返回命令列表

Linux command

docker-slim 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

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]

说明

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.

参数

--http-probe
Enable HTTP probing.
--include-shell
Include shell in slimmed image.
--target _string_
Target output image name.
--expose _port_
Expose additional ports.

FAQ

What is the docker-slim command used for?

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.

How do I run a basic docker-slim example?

Run `docker-slim build [image]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --http-probe do in docker-slim?

Enable HTTP probing.