Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Andreas Hansson
    @andreas.hansson2_gitlab
    Hi in trying to use docker-slim in my gitlab pipeline. But get this ettor: make sure the target image already exists locally'
    I have built an image before running docker-slim
    Andreas Hansson
    @andreas.hansson2_gitlab
    Hi can i include all files in a directory?
    --include-path i have to specify whole path to file to make it work.
    But I need to include 100 of files in a directory
    Anyone who knows? @kcq
    Kyle Quest
    @kcq
    @andreas.hansson2_gitlab do you mind sharing the output of docker images (feel free to exclude the images that are not relevant). Also can you share the full command line when you run docker-slim? Ping me directly if you don't want to share it publicly.
    --include-path works with directories too, so no need to include each file individually
    toothedsword
    @toothedsword
    docker images
    REPOSITORY TAG IMAGE ID CREATED SIZE
    fogf.18.04.tar latest 088790bdafa6 3 days ago 1.85GB
    ./docker-slim build --http-probe ca88504b7e59
    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'
    docker-slim[build]: info=http.probe message='using default probe'
    cmd=build state=started
    cmd=build info=params target=ca88504b7e59 continue.mode=probe rt.as.user=true keep.perms=true
    cmd=build info=target.image.error status=not.found image='ca88504b7e59' message='make sure the target image already exists locally'
    cmd=build state=exited
    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'
    Do you know what's the problem of this? Thanks!
    ./docker-slim build --http-probe 088790bdafa6
    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'
    docker-slim[build]: info=http.probe message='using default probe'
    cmd=build state=started
    cmd=build info=params target=088790bdafa6 continue.mode=probe rt.as.user=true keep.perms=true
    cmd=build info=target.image.error status=not.found image='088790bdafa6' message='make sure the target image already exists locally'
    cmd=build state=exited
    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'
    Kyle Quest
    @kcq
    @toothedsword that was pretty helpful! thanks a lot!
    turns out this is a bug with accepting image IDs and i’ll fix it asap
    for now, try using the image name and tag instead of using images IDs (e.g., ./docker-slim build --http-probe fogf.18.04.tar:latest)
    Kyle Quest
    @kcq
    ability to reference the target images by their ID (full or partial) will be available in the next release, which would happen pretty soon (it’s already in master if you’d like to see it sooner)
    chris
    @csmizzle
    Hey all, quick question. It isn't clear to me in the docs which flag to use when I want to specify which files I do not want removed during slimming. Any help there would be great! thanks
    If I want to keep dirs relevant to pip/npm/dependencies that are being removed during the slimming process
    Kyle Quest
    @kcq
    @csmizzle you can use the —include-path parameter for it (to keep additional files or directories in your optimized image). another option is —include-path-file, which you can use if you have a lot of files or directories to keep.
    there’s a few extra —include-* parameters you can use too: —include-bin, —include-bin-file, —include-exe, —include-exe-file and —include-shell.
    —include-bin is a more intelligent version of include-path when it comes to keeping additional binary files in your optimized image. It will include the file you specify and it will also include any other files that binary references, so if you —include-bin a shared object (aka dynamic library) docker-slim will include that shared object and it will also include the shared libraries that shared object imports.
    Kyle Quest
    @kcq
    —include-exe is like —include-bin, but it also tries to locate the target executable in one of the paths where you have your executables (based on the usual executable path locations)
    —include-shell includes enough executables to give you a basic read-only shell experience
    Joe Tan
    @joetancy
    hello all, i need some help on this. As I have a entrypoint.sh for the docker image that replaces a string in some config file, when I use docker-slim to create a slim image, the entrypoint is triggered once, and its triggered again when running the container, therefore e.g I'm replacing "http {" with "http { config...", when it runs twice it becomes "http{ config... config...". is there a better way to do this?
    Kyle Quest
    @kcq
    @joetancy One potential hack there is to mount a fresh copy of that config file (as a volume using the -v docker run param) when you run your optimized container. Would it be possible to do? There’s a couple of extra capabilities I can add to docker-slim to streamline this use case. One is an ability to copy files within the container image when docker-slim is running it. This would make it possible to mount your clean config as a new file and then it would replace the modified config file. Another option is a capability to add extra files to the optimized image during the build step, so you’d be able to replace the modified config file with a fresh copy.
    Kyle Quest
    @kcq
    @joetancy there’s a new flag that should cover your use case (it’ll be available in the next release, but you can build the latest from the repo to get it if you’d like to try it sooner): --preserve-path. Set its value to your entrypoint’s file path something like this: docker-slim build --preserve-path /path/to/your/entrypoint.sh your-container-image-name
    Joe Tan
    @joetancy
    @kcq wow, thank you so much for this! will let you know how it works after its released!
    Kyle Quest
    @kcq
    should be available in the next couple of days
    Kyle Quest
    @kcq
    @joetancy the new release (1.35.0) has been out for a few days with this new -preserve-path flag and lots of other enhancements. Give it a try (linux: https://downloads.dockerslim.com/releases/1.35.0/dist_linux.tar.gz and macs: https://downloads.dockerslim.com/releases/1.35.0/dist_mac.zip )
    Kyle Quest
    @kcq
    Did you know that you can also use DockerSlim like grep for container images? For example, here we'll find and print all files that include 'Welcome to nginx': docker-slim xray --change-data 'dump:console::Welcome to nginx' nginx
    bt-nia
    @bt-nia
    hey everyone!
    I have a docker container that runs as a daemon, which means that it will not stop when running --exec. How can I let docker-slim know that the container analysis is done?
    Kyle Quest
    @kcq
    @bt-nia Is it a web server or something like that? The —continue-afterparameter to docker-slim defines how you want to decide when the analysis is done. The parameter defaults to probe, which means that docker-slim will wait until all (http) probes are done executing and then it moves on to the next phase. In addition to configuring custom http probe commands with --http-probe-cmd and --http-probe-cmd-file you can also invoke external apps during the probing phase. This can be done using the --http-probe-exec and --http-probe-exec-file parameters, which allows you to use those external apps to decide when the analysis is done.
    There are other —continue-after options you can use to decide when the analysis phase is done. enter tells docker-slim to wait for external console input. That way you can manually signal the end of the analysis phase.
    The signal --continue-after option lets you use unix signals to let docker-slim know when the analysis phase should be done.
    Kyle Quest
    @kcq
    The timeout —continue-after option gives you have a time-based approach to dedice when the analysis phase is done. You can specify a number to —continue-after to choose how many seconds you want to wait before the analysis phase is done.
    The exec —continue-after option lets you indicate that you want the analysis phase to be done once the shell commands passed through the —exec or —exec-file params are done executing in the temporary container.
    Note that you can combine the exec and probe options (e.g., --continue-after probe&exec). With these stacked options the analysis phase will be done once the exec commands are done executing and the probing phase is done.
    bt-nia
    @bt-nia
    @kcq Thanks a lot for the detailed answer! In fact I noticed that in an other case the analysis asked me to press enter, but for some reason it did not do that in this case. I'm also updating my question in the discussion board on github.
    @kcq all right, nvm yo already answered my question there as well :D
    Thanks a bunch!
    bt-nia
    @bt-nia
    Is it possible to add docker run parameters to the docker-slim build command? Some/all of the ones mentioned here: https://docs.docker.com/engine/reference/commandline/run/ . For my use case I'm looking to increase the shm size via --shm-size
    Kyle Quest
    @kcq
    @bt-nia there’s going to be a dedicated flag for it in the next release (called --cro-shm-size), but there’s already a flag you can leverage to get the same results. It’s called --cro-host-config-file and you can specify a custom shared mem size in the ShmSize there. You’ll need to build the latest code yourself to get the --cro-host-config-file flag.
    1 reply
    Kyle Quest
    @kcq
    When you minify your images or when you are looking for new images to use you want to understand what's inside. It's easy to do with Slim SaaS, but the image needs to be stored in a registry. Here's a short demo that shows how to explore and investigate local images you don't have in a registry yet: https://downloads.dockerslim.com/share/docker-slim-xray-upload.gif
    Kyle Quest
    @kcq
    You can do the same by uploading your xray command artifacts on this page (note: the invite code from the URL should auto-fill on the login page): https://portal.slim.dev/xrayupload?invitecode=invite.1s85zlfnYX0p5TT1XKja49pAHbL
    Chas Emerick
    @cemerick
    slim was able to give me a 58MB image for a nontrivial webapp, which seems great. To get there though, I had to use --include-shell, even though the container has a non-shell CMD set (otherwise, I got exec user process caused "no such file or directory"). Any idea why?
    1 reply
    Chas Emerick
    @cemerick
    Also, it seems slim is only running / GET, and not following any links. I've tried a couple different flags (e.g. --http-probe-crawl --http-probe-cmd crawl:/), but they only seem to change how many times / is retrieved
    1 reply
    Joshua Hogendorn
    @jhogendorn
    hey all, i'm attempting to run docker slim from the containerised version, however i'm getting broken pipe on docker.sock. any pointers?
    Sugato Ray
    @sugatoray

    I am new to using docker-slim. I tried using docker-slim on ubuntu 20.04 and it worked with slimming down an nginx (official) docker image. But when I tried using the same technique on official image of ubuntu:20.04 or ubuntu:18.04, it threw an error. Is this quite common with ubuntu:20.04? Any help will be appreciated. Thank you.

    Failure message With ubuntu:20.04

    $ docker-slim build --target ubuntu:20.04 --tag sugatoray/ubuntu.slim:20.04
    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=param.http.probe message='using default probe' 
    cmd=build state=started
    cmd=build info=params rt.as.user='true' keep.perms='true' tags='sugatoray/ubuntu.slim:20.04' target.type='image' target='ubuntu:20.04' continue.mode='probe' 
    cmd=build state=image.inspection.start
    cmd=build info=image id='sha256:ba6acccedd2923aee4c2acc6a23780b14ed4b8a5fa4e14e252a23b846df9b6c1' size.bytes='72776513' size.human='73 MB' 
    cmd=build info=image.stack id='sha256:ba6acccedd2923aee4c2acc6a23780b14ed4b8a5fa4e14e252a23b846df9b6c1' index='0' name='ubuntu:20.04' 
    cmd=build state=image.inspection.done
    cmd=build state=container.inspection.start
    cmd=build info=container status='created' name='dockerslimk_1783268_20211026094927' id='db7d8b4f1abc847b0be54a88c497495cf72eca8b9e31fd79194acb0284fa866b' 
    time="2021-10-26T04:49:28-05:00" level=error msg="channel.Client.Read: read error (read tcp 127.0.0.1:58832->127.0.0.1:49175: read: connection reset by peer), exiting..."
    time="2021-10-26T04:49:28-05:00" level=error msg="channel.NewCommandClient: channel verify error = read tcp 127.0.0.1:58832->127.0.0.1:49175: read: connection reset by peer"
    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_1783268_20211026094927' id='db7d8b4f1abc847b0be54a88c497495cf72eca8b9e31fd79194acb0284fa866b' 
    cmd=build state=http.probe.error error=no exposed ports message=expose your service port with --expose or disable HTTP probing with --http-probe=false if your containerized application doesnt expose any network services 
    cmd=build state=exited code=33554435
    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'
    Kyle Quest
    @kcq
    @sugatoray summarizing what i added in the github issue, so others here might benefit from the info… By default, docker-slim expects to see ports in the target image, so it can probe the application running in the container using those ports, but the ubuntu image doesn’t have any ports declared. It’s a base image that you’d normally use to be a containerized app. You can disable probing by using the —http-probe=false flag, but if you want to minify a base image like ubuntu you’ll need to figure out what you still want in that base image and you’ll need to use —include-path or other similar parameter to tell docker-slim about what you want to keep. Normally when you minify an application container image you don’t need to do that because your application provides enough information for docker-slim. Without an application docker-slim can’t guess how you intend to use the image and that’s why you need to use those —include-* parameters.
    1 reply
    Ben Talberg
    @btalberg
    Hey all, new to docker-slim. Has anyone had trouble with the python3 requests library after slim-ifying their container? Our app authenticates against Auth0, and the app is failing when trying to fetch Auth0's JSON Web Keys. I see a Name or service not known error, so this appears to be a problem with the container's DNS routing. I've looked at the hostname, resolv.conf, etc. files, and compared the docker inspectoutput, between the fat and the slimmed containers, and I can't see anything glaringly wrong or different. I also used --include-path to include everything under /etc and everything under python's site-packages folder. I can upload more info, but I thought I'd start here. Here's the request connection error:
    requests.exceptions.ConnectionError: HTTPSConnectionPool(host='wildflowerschools.auth0.com', port=443): Max retries exceeded with url: /.well-known/jwks.json (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f8d2239ccd0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
    1 reply
    Kyle Quest
    @kcq
    @btalberg thank you for sharing! need to investigate this a bit more. Ideally you shouldn't need those includes. We'll figure out what's going on :)
    1 reply
    rajatariya21
    @rajatariya21
    Hi everyone, I am facing an issue related to the docker-slim image. When running a python application with normal docker images, the application is running on Flask and the API URL is also working. When running this application with docker-slim image, the application is running but none of the APIs are working.
    Get the following error "home:1 Access to XMLHttpRequest at 'http://localhost:7002/PATH' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource."