slimtoolkit / slimtoolkit/slim

Minifying MicroShift image using docker-slim : Output Image is literally unusable

Open
#315 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
23.4k
Forks
840
PR merge metrics
No merged PRs in 30d

Description

Expected Behavior

I was expecting to reduce the size of MicroShift image from 1.3GB to slightly lower.


Actual Behavior

However upon running docker-slimi the resultant image is 24MB but it is not usable. Docker-Slim removed every thing.


Steps to Reproduce the Problem

  1. docker pull quay.io/microshift/microshift-aio
  2. docker-slim build --http-probe=false quay.io/microshift/microshift-aio
  3. docker images
  4. The original imager is 1.3GB and the resultant image is 24MB , however the final image generated by docker-slim is not at all u sable.
  5. To test you can launch microshift (which is a thin version of OpenShift )
docker run -d --rm --name microshift --privileged -v microshift-data:/var/lib -p 6443:6443 quay.io/microshift/microshift-aio

docker run -d --rm --name microshift --privileged -v microshift-data:/var/lib -p 6443:6443 quay.io/microshift/microshift-aio.slim

docker exec -it microshift /bin/bash
kubectl get nodes
kubectl get pods -A
  1. If you get the output of the above 2 commands, it proves success

Specifications

  • Version:
cmd=version info=app version='darwin|Transformer|1.37.5|latest|latest' container=false dsimage=false
cmd=version info=app outdated=false current=1.37.5 verdict='you have the latest version'
cmd=version info=app location='/usr/local/bin'
cmd=version info=host osname='other'
cmd=version info=host osbuild=21E258
cmd=version info=host version=' Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64'
cmd=version info=host release=21.4.0
cmd=version info=host sysname=darwin
cmd=version info=docker name=docker-desktop
cmd=version info=docker kernel_version=5.10.104-linuxkit
cmd=version info=docker operating_system=Docker Desktop
cmd=version info=docker ostype=linux
cmd=version info=docker server_version=20.10.13
cmd=version info=docker architecture=x86_64
cmd=version info=dclient api_version=1.41
cmd=version info=dclient min_api_version=1.12
cmd=version info=dclient build_time=2022-03-10T14:06:05.000000000+00:00
cmd=version info=dclient git_commit=906f57f
  • Platform:
    macOS
  • Logs


$ docker-slim build --http-probe=false quay.io/microshift/microshift-aio
docker-slim: message='join the Gitter channel to ask questions or to share your feedback' info='https://gitter.im/docker-slim/community'
docker-slim: message='join the Discord server to ask questions or to share your feedback' info='https://discord.gg/9tDyxYS'
docker-slim: message='Github discussions' info='https://github.com/docker-slim/docker-slim/discussions'
cmd=build info=exec message='changing continue-after from probe to nothing because http-probe is disabled'
cmd=build info=exec message='changing continue-after to enter'
cmd=build state=started
cmd=build info=params keep.perms='true' tags='' target.type='image' target='quay.io/microshift/microshift-aio' continue.mode='enter' rt.as.user='true'
cmd=build state=image.inspection.start
cmd=build info=image size.human='1.3 GB' id='sha256:b7b2874ce63cf84ad469aa52ce8416d87f4105ba91666818f9e9cc25a943557e' size.bytes='1300787771'
cmd=build info=image.stack index='0' name='quay.io/microshift/microshift-aio:latest' id='sha256:b7b2874ce63cf84ad469aa52ce8416d87f4105ba91666818f9e9cc25a943557e'
cmd=build state=image.inspection.done
cmd=build state=container.inspection.start
cmd=build info=container status='created' name='dockerslimk_5910_20220419150335' id='b22e667c6dbcfce0810f4462b9af0b12ab2294f21fbe58d95f2b264fe27f6217'
cmd=build info=container status='running' name='dockerslimk_5910_20220419150335' id='b22e667c6dbcfce0810f4462b9af0b12ab2294f21fbe58d95f2b264fe27f6217'
cmd=build info=container message='obtained IP address' ip='172.17.0.2'
cmd=build info=cmd.startmonitor status='sent'

cmd=build info=event.startmonitor.done status='received'
cmd=build info=container target.port.list='' target.port.info='' message='YOU CAN USE THESE PORTS TO INTERACT WITH THE CONTAINER' name='dockerslimk_5910_20220419150335' id='b22e667c6dbcfce0810f4462b9af0b12ab2294f21fbe58d95f2b264fe27f6217'
cmd=build info=continue.after mode='enter' message='provide the expected input to allow the container inspector to continue its execution'
cmd=build prompt='USER INPUT REQUIRED, PRESS <ENTER> WHEN YOU ARE DONE USING THE CONTAINER'
cmd=build state=container.inspection.finishing
cmd=build state=container.inspection.artifact.processing
cmd=build state=container.inspection.done
cmd=build state=building message="building optimized image"
cmd=build state=completed
cmd=build info=results status='MINIFIED' by='54.15X' size.original='1.3 GB' size.optimized='24 MB'
cmd=build info=results image.name='quay.io/microshift/microshift-aio.slim' image.size='24 MB' has.data='true'
cmd=build info=results artifacts.location='/tmp/docker-slim-state/.docker-slim-state/images/b7b2874ce63cf84ad469aa52ce8416d87f4105ba91666818f9e9cc25a943557e/artifacts'
cmd=build info=results artifacts.report='creport.json'
cmd=build info=results artifacts.dockerfile.reversed='Dockerfile.fat'
cmd=build info=results artifacts.dockerfile.optimized='Dockerfile'
cmd=build info=results artifacts.seccomp='quay.io-microshift-microshift-aio-seccomp.json'
cmd=build info=results artifacts.apparmor='quay.io-microshift-microshift-aio-apparmor-profile'
cmd=build state=done
cmd=build info=commands message='use the xray command to learn more about the optimize image'
cmd=build info=report file='slim.report.json'
docker-slim: message='join the Gitter channel to ask questions or to share your feedback' info='https://gitter.im/docker-slim/community'
docker-slim: message='join the Discord server to ask questions or to share your feedback' info='https://discord.gg/9tDyxYS'
docker-slim: message='Github discussions' info='https://github.com/docker-slim/docker-slim/discussions'
$

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the docker-slim build command against quay.io/microshift/microshift-aio with HTTP probing disabled, then inspect slim.report.json, creport.json, Dockerfile, and Dockerfile.fat from the reported artifacts. Compare the original and .slim images using the supplied docker run commands and kubectl get nodes and kubectl get pods -A; done means the minified image remains usable.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.