slimtoolkit / slim

Slim(toolkit): Don't change anything in your container image and minify it by up to 30x (and for compiled languages even more) making it secure too! (free and open source)
Apache License 2.0
19.21k stars 716 forks source link

provide the expected input to allow the container inspector to continue its execution #447

Closed alifiroozi80 closed 1 year ago

alifiroozi80 commented 1 year ago

Expected Behavior

Hello I'm new to slim and want to use it in my CICD pipeline.

When I try to resize a python image, it stops and shows me this message:

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

And after I press Enter, it will build the container successfully.


The problem is I'm not going to be there when the pipeline executes the command to press Enter! is there any flag or option to automate this?


The command:

docker-slim --report=off build --target 2b7ca628da40 --tag python:test1 --show-blogs --http-probe=false
app='docker-slim' message='Join the Gitter channel to ask questions or to share your feedback' info='https://gitter.im/docker-slim/community'
app='docker-slim' message='Join the Discord server to ask questions or to share your feedback' info='https://discord.gg/9tDyxYS'
app='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 continue.mode='enter' rt.as.user='true' keep.perms='true' tags='python:test1' target.type='image' target='2b7ca628da40' 
cmd=build state=image.inspection.start
cmd=build info=image id='sha256:2b7ca628da40dc0cdfc6bf518b0f8cc0c5c3b83e89960e265e540cc7502ceee5' size.bytes='919788091' size.human='920 MB' 
cmd=build info=image.stack index='0' name='' id='sha256:2b7ca628da40dc0cdfc6bf518b0f8cc0c5c3b83e89960e265e540cc7502ceee5' 
cmd=build state=image.inspection.done
cmd=build state=container.inspection.start
cmd=build info=container status='created' name='dockerslimk_3860711_20230109063239' id='4511bc9fe6f561100f925809a26a7abac6a1a4de0969c57664023f076de30d10' 
cmd=build info=container status='running' name='dockerslimk_3860711_20230109063239' id='4511bc9fe6f561100f925809a26a7abac6a1a4de0969c57664023f076de30d10' 
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 name='dockerslimk_3860711_20230109063239' id='4511bc9fe6f561100f925809a26a7abac6a1a4de0969c57664023f076de30d10' target.port.list='' target.port.info='' message='YOU CAN USE THESE PORTS TO INTERACT WITH THE CONTAINER' 
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'

Specifications

lifehacking commented 1 year ago

me too

alifiroozi80 commented 1 year ago

OK, I did find a temporary solution for now:

Keep the httpProbe enabled, and add an option to the command that doesn't fail after the httpProbe check. (--http-probe-exit-on-failure=false)

Also, by default it will retry 5 times, so, it is a good idea to set it to 1 (Can't set it to 0 unfortunately) (--http-probe-retry-count=1)

Here is the command:

docker-slim --report=off build --target 2b7ca628da40 --tag python:test1 --show-blogs --http-probe-retry-count=1 --http-probe-exit-on-failure=false
kcq commented 1 year ago

@alifiroozi80 you should try the --continue-after parameter. Your original command disabled http probing and the app defaulted to the interactive mode instead. You can explicitly pick the continue mode that works better in CI environments. The README has a number of references about that parameter, but here's a high level overview to give you an idea:

You can pick one of these 'continue' modes:

alifiroozi80 commented 1 year ago

Thank you so much, @kcq.

This is the solution.

I added the --continue-after=10 to my command, and now everything is perfect.

Here is the complete command:

docker-slim --report=off build --target 2b7ca628da40 --tag python:test1 --show-blogs --http-probe=false --continue-after=10
dityudha commented 8 months ago

thanks for your help @kcq