使用docker-slim工具使用进行镜像瘦身
在线使用
直接使用docker进行下载
docker pull docker-slim
离线下载
下载链接:
下载对应平台的包。
Latest Mac binaries (curl -L -o ds.zip https://downloads.dockerslim.com/releases/1.40.3/dist_mac.zip)
Latest Mac M1 binaries (curl -L -o ds.zip https://downloads.dockerslim.com/releases/1.40.3/dist_mac_m1.zip)
Latest Linux binaries (curl -L -o ds.tar.gz https://downloads.dockerslim.com/releases/1.40.3/dist_linux.tar.gz)
Latest Linux ARM binaries (curl -L -o ds.tar.gz https://downloads.dockerslim.com/releases/1.40.3/dist_linux_arm.tar.gz)
Latest Linux ARM64 binaries (curl -L -o ds.tar.gz https://downloads.dockerslim.com/releases/1.40.3/dist_linux_arm64.tar.gz)
离线
tar -xvf dist_linux.tar.gz
mv dist_linux/docker-slim /usr/local/bin/
mv dist_linux/slim-sensor /usr/local/bin/
mv dist_linux/slim /usr/local/bin/
怎么使用
docker-slim build --http-probe=false
--include-path=/etc/
--include-path=/usr/local/bin/
--include-path=/usr/local/sbin/
--include-path=/usr/local/lib/
--include-path=/usr/local/etc/
--include-bin=/bin/bash --cmd "/usr/sbin/init" cf68cb3d6ad0
--http-probe 不要开启网络检测
--include-path 需要优化的目录
--cmd 保留优化命令