Open quemeraisc opened 2 years ago
Thanks for sharing the issue @quemeraisc ! what does your requirements.txt
look like? Is this a server app? How did you try to minify your image? What flags did you pass to the docker-slim build
command? What's the console output when you ran docker-slim build
?
hello @kcq. I used the basic command docker-slim build --http-probe=false --target enrichment/iosx
.
The requirement file is the python requirement for my app, as follows:
junos-eznc>=2.4
ipaddress==1.0.23
netmiko==2.4.2
cryptography==2.6.1
those are some networking module and the crypto module. This app is connecting to a bunch a network equipement collecting information. Here is the output of the build:
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 rt.as.user='true' keep.perms='true' tags='' target.type='image' target='enrichment/iosxr' continue.mode='enter'
cmd=build state=image.inspection.start
cmd=build info=image size.bytes='982843958' size.human='983 MB' id='sha256:9520ca407acba605a56ab30c30188b6d6cfc71648315790c98019615ec949124'
cmd=build info=image.stack index='0' name='python:3' id='sha256:4dd615d90c9da26a8137ab95596c80093e7a36e92f2303af96236a5503f26e42'
cmd=build info=image.stack name='enrichment/iosxr:latest' id='sha256:9520ca407acba605a56ab30c30188b6d6cfc71648315790c98019615ec949124' index='1'
cmd=build state=image.inspection.done
cmd=build state=container.inspection.start
cmd=build info=container name='dockerslimk_6763_20220422090316' id='76e424f1f087f18a3caf9256e0b7606449b0b128d7a92a52d00bda713a7def92' status='created'
cmd=build info=container status='running' name='dockerslimk_6763_20220422090316' id='76e424f1f087f18a3caf9256e0b7606449b0b128d7a92a52d00bda713a7def92'
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_6763_20220422090316' id='76e424f1f087f18a3caf9256e0b7606449b0b128d7a92a52d00bda713a7def92' 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'
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 size.original='983 MB' size.optimized='67 MB' status='MINIFIED' by='14.67X'
cmd=build info=results image.name='enrichment/iosxr.slim' image.size='67 MB' has.data='true'
cmd=build info=results artifacts.location='/home/sysadmin/bin/.docker-slim-state/images/9520ca407acba605a56ab30c30188b6d6cfc71648315790c98019615ec949124/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='enrichment-iosxr-seccomp.json'
cmd=build info=results artifacts.apparmor='enrichment-iosxr-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'
Maybe this can help.
I have just tried to use the alpine
derivative of python's docker and got to an error message also concerning the cryptography
module. There seems to be a missing compiler in that case.
There might be something similar happening when using docker-slim.
No error came up at build time though
i'm getting a similar issue as well for SQLAlchemy
File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/langhelpers.py", line 343, in load
raise exc.NoSuchModuleError(
sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:sqlite
and tornado
Could not load pycurl: No module named 'tornado.curl_httpclient'
Expected Behavior
docker run of my image runs perfectly my python code using various packages (important here: juniper
pyez
andcryptography
)Actual Behavior
docker run of the slim version crashes output here :
Dockerfile: