shell>./docker-slim build\--http-probe=false\--expose80\--expose3306\--include-path=/var/www/html\--include-path=/var/log/httpd\--include-path=/run/httpd\--include-path=/tmp\--include-path=/data\--include-path=/etc\--include-path=/usr/\--include-path=/sbin/\--include-path=/ro...
使用docker-slim的build命令来优化镜像: docker-slim build <image_name> 例如:如果你有一个名为my-app的 Docker 镜像,运行以下命令: docker-slim build my-app 这个命令会生成一个精简的镜像,并且新镜像名称前面会带有slim-前缀,如slim-my-app。 3.运行优化后的镜像 使用docker run命令运行优化后的镜像: docke...
$ docker pull dslim/slim 然后,使用slim build优化镜像 u/test-docker-nodeapp $ docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock dslim/slim build u/test-docker-nodeapp 运行成功后,生成一个新的镜像以.slim结尾,体积从921MB减小到55.1MB。 $ docker images REPOSITORY TAG ...
slim build myapp:latest 这个简单的命令会分析你的镜像,创建一个优化版本,并将结果保存为myapp.slim:latest。 如果你想要更多控制,可以使用更多参数: slim build --http-probe=true--expose=80 myapp:latest 这个命令会启用HTTP探测,并暴露80端口进行测试。 核心特性详解 让我们深入了解Slim的一些核心特性,看看它们...
docker-slim build --http-probe=false 753933d7a042 我们再看一下他已经生成了53兆的心镜像,镜像的名称是老镜像加上后缀slim 'docker.io/ducheng1234/spring-boot-demo-codegen.slim 然后我们再看看slim-report.json 这里面有有新镜像的详情构建过程,类似docker inspect imagesid . ...
1. 使用slim build优化python:3.7.0-test镜像 AI检测代码解析 docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock dslim/slim build --http-probe=false --include-shell=true --include-path=/usr --include-path=/sbin --include-path=/bin --include-path=/lib python:3.7.0-te...
dockerrun--rm-v$(pwd):/app docker-slim/docker-slim build my-flask-app 1. 运行以上命令后,Docker Slim会分析你的应用,并创建一个经过优化的新镜像。优化后的镜像通常会被命名为my-flask-app.slim。 验证优化结果 使用以下命令查看优化前后的镜像大小: ...
docker-slim build --http-probe=false --target nginx:latest --tag nginx:slim 默认会开启http的探测(--http-probe)。我们build的时候给他关上我们看到 nginx 镜像从 142MB 减到了 12.4MB,至此,本次教程就到这里了。合集: Docker系列 分类: 技术教程 标签: docker , 技术教程 好文要顶 关注我 收藏...
Example: docker-slim build my/sample-app See the USAGE DETAILS section for more details. You can also get additional information about the parameters running docker-slim. Run docker-slim help to get a high level overview of the available commands. Run a docker-slim command without any parameter...
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock dslim/slim build myapp 这将生成一个新的优化后的镜像,通常命名为 myapp.slim。 验证优化结果: 使用以下命令查看优化前后的镜像大小: bash docker images Docker Slim 的常用命令和选项 基本命令: bash docker run -it --rm -v...