Closed oxr463 closed 4 years ago
If I see this correctly, this would involve creating a proper build pipeline. Currently, I am building images with docker hub automated builds. I suppose, they do not support docker-slim.
Looks nice, btw. Did you build this images and compare the sizes?
Here is a good example from one of my projects,
Original size: 300 MiB Current size: 1.65 MiB
Source: https://gitlab.com/hexgearinc/ryzomcore-docker/-/blob/master/.gitlab-ci.yml
Awesome. Working on this right now. Probably replacing docker hub builds with gitlab pipelines by today.
Probably replacing docker hub builds with gitlab pipelines by today.
Love GitLab CI/CD! This will help with testing PRs too.
Yeap, and big performance boost compared to docker hub builds.
Alright, I reduced the image size from ~2.5GB to 40MB....
This looks suspicious to me. I doubt, we can compress the android SDK to that size. I tried to investigate and cannot even call ls
in the container:
[le@y730]: ~/src/docker-android-sdk>$ docker run --rm -ti runmymind/docker-android-sdk:ubuntu-standalone-feature-pipeline bash
bash-4.4# ls
bash: ls: command not found
Is that expected? How can we make sure, we do not break things?
Is that expected? How can we make sure, we do not break things?
How did you build the image?
Pretty much analog to https://gitlab.com/hexgearinc/ryzomcore-docker/-/blob/master/.gitlab-ci.yml
- docker build -t runmymind/docker-android-sdk:$TAG_PREFIX-$CI_COMMIT_REF_SLUG -f ${TAG_PREFIX/-/\//}/Dockerfile .
- docker run -v /var/run/docker.sock:/var/run/docker.sock dslim/docker-slim build --http-probe=false runmymind/docker-android-sdk:$TAG_PREFIX-$CI_COMMIT_REF_SLUG
- docker tag runmymind/docker-android-sdk.slim runmymind/docker-android-sdk:$TAG_PREFIX-$CI_COMMIT_REF_SLUG
- docker push runmymind/docker-android-sdk:$TAG_PREFIX-$CI_COMMIT_REF_SLUG
If I try to use it in a CI, it does not work. It seems like almost everything from the image was erased.
Is there an explanation what docker-slim is actually doing?
Check this out: https://github.com/docker-slim/docker-slim#minifying-command-line-tools, https://github.com/docker-slim/docker-slim#can-i-use-dockerslim-with-dockerized-command-line-tools. It strips out basically everything it can, so if you need a tool then you should declare it when you are building the slimmed down image.
Alright. Understand. This seem to be a long and error prone task. Especially, because many people use this image and I have no idea what they exactly do with it.
If you know what you are doing, I am happy to accept a PR for minified images. We can then gather feedback and see how it goes. But I think, I am going to offer both variants for a while then.
Closing due to lack of activity.
See: https://github.com/docker-slim/docker-slim