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

Not able to create slim images with - Docker slim 1.39.0 #442

Open madhushesharam opened 1 year ago

madhushesharam commented 1 year ago

Expected Behavior

On running docker-slim build $IMAGE , create a SLIM image

using dummy helloworld python image.

Can somebody please help with this, do i need to do more with my config params?

Actual Behavior

$ testpy % docker-slim build hello-world-python

Getting below exception

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=param.http.probe message='using default probe' cmd=build state=started cmd=build info=params target.type='image' target='hello-world-python' continue.mode='probe' rt.as.user='true' keep.perms='true' tags='' cmd=build state=image.inspection.start cmd=build info=image id='sha256:4c9bff646815b2c4a43633af4925cc61270bea6ac95db6c459287b6ff1bd4d93' size.bytes='954012097' size.human='954 MB' cmd=build info=image.stack index='0' name='python:3' id='sha256:75cc8d87cc34bdb26dfcbe6c9e4483d9b483761510b5069852f52bd8431b8012' cmd=build info=image.stack index='1' name='hello-world-python:latest' id='sha256:4c9bff646815b2c4a43633af4925cc61270bea6ac95db6c459287b6ff1bd4d93' cmd=build info=image.exposed_ports list='3000' cmd=build state=image.inspection.done cmd=build state=container.inspection.start cmd=build info=container status='created' name='dockerslimk_13051_20221228001142' id='789e33a74a0202417cb75c29311097e87786ecba71d1b699141d46dab913618d' cmd=build info=container status='running' name='dockerslimk_1305120221228001142' id='789e33a74a0202417cb75c29311097e87786ecba71d1b699141d46dab913618d' cmd=build info=container message='obtained IP address' ip='172.17.0.3' cmd=build info=cmd.startmonitor status='sent' cmd=build info=event.startmonitor.done status='received.unexpected' data='&{Name:event.monitor.start.failed Data:}' cmd=build info=report file='slim.report.json' time="2022-12-27T17:11:44-07:00" level=fatal msg="docker-slim: failure" error="unexpected event type" stack="goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x65\ngithub.com/docker-slim/docker-slim/pkg/util/errutil.FailOn({0x2a8f160, 0xc0004a8c60})\n\tgithub.com/docker-slim/docker-slim/pkg/util/errutil/errutil.go:28 +0x5e\ngithub.com/docker-slim/docker-slim/pkg/app.(*ExecutionContext).FailOn(0xc000432000?, {0x2a8f160?, 0xc0004a8c60?})\n\tgithub.com/docker-slim/docker-slim/pkg/app/execontext.go:56 +0x49\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.OnCommand(, , {, }, , {, }, {, }, {0x0, ...}, ...)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/handler.go:876 +0x456b\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.glob..func1(0xc000390d40)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/cli.go:607 +0x4730\ngithub.com/urfave/cli/v2.(Command).Run(0x3865720, 0xc00058c680)\n\tgithub.com/urfave/cli/v2@v2.3.0/command.go:163 +0x5dc\ngithub.com/urfave/cli/v2.(App).RunContext(0xc000007ba0, {0x2aa85d0?, 0xc000198008}, {0xc00018e090, 0x3, 0x3})\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:313 +0xb7d\ngithub.com/urfave/cli/v2.(*App).Run(...)\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:224\ngithub.com/docker-slim/docker-slim/pkg/app/master.Run()\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/app.go:15 +0x46\nmain.main()\n\tgithub.com/docker-slim/docker-slim/cmd/docker-slim/main.go:15 +0x18e\n" version="darwin|Transformer|1.39.0|latest|latest"


Steps to Reproduce the Problem

1. % cat Dockerfile FROM python:3 ADD helloworld.py / RUN pip install flask RUN pip install flask_restful EXPOSE 3000 CMD [ "python", "./helloworld.py"] 2. % cat helloworld.py from flask import Flask, request from flask_restful import Resource, Api app = Flask(__name__) api = Api(app) class Greeting (Resource): def get(self): return 'Hello World!' api.add_resource(Greeting, '/') # Route_1 if __name__ == '__main__': app.run('0.0.0.0','3000') 3. To build the image, run docker build -t hello-world-python . docker-slim build --http-probe=false hello-world-python # tried with http-probe=false --- Specifications ================= - Version: % docker-slim --version docker-slim version darwin|Transformer|1.39.0|latest|latest % docker --version Docker version 20.10.22, build 3a2c30b63a - Platform: Software: System Software Overview: System Version: macOS 13.1 (22C65) Kernel Version: Darwin 22.2.0 Boot Volume: Macintosh HD Boot Mode: Normal Hardware: Hardware Overview: Model Name: MacBook Pro Model Identifier: MacBookPro14,3 Processor Name: Quad-Core Intel Core i7 Processor Speed: 2.9 GHz Number of Processors: 1 Total Number of Cores: 4 L2 Cache (per Core): 256 KB L3 Cache: 8 MB Hyper-Threading Technology: Enabled Memory: 16 GB System Firmware Version: 499.40.2.0.0 OS Loader Version: 564.40.4~55 **Debug Mode Output** ` % docker-slim --debug build --http-probe=true hello-world-python time="2022-12-27T17:22:23-07:00" level=debug msg="sysinfo => system.SystemInfo{Sysname:\"darwin\", Nodename:\"C02VC92QHTD6\", Release:\"22.2.0\", Version:\" Fri Nov 11 02:08:47 PST 2022; root:xnu-8792.61.2~4/RELEASE_X86_64\", Machine:\"x86_64\", Domainname:\"\", OsBuild:\"22C65\", Distro:system.DistroInfo{Name:\"\", Version:\"\", DisplayName:\"other\"}}" 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' time="2022-12-27T17:22:23-07:00" level=debug msg="param.error.app.options - no app params" cmd=build info=param.http.probe message='using default probe' time="2022-12-27T17:22:23-07:00" level=debug msg="customImageTag='', additionalTags=[]string(nil)" app=docker-slim command=build time="2022-12-27T17:22:23-07:00" level=debug msg="docker-slim: new Docker client (env) [5]" cmd=build state=started cmd=build info=params rt.as.user='true' keep.perms='true' tags='' target.type='image' target='hello-world-python' continue.mode='probe' time="2022-12-27T17:22:23-07:00" level=info msg="image=hello-world-python http-probe=true remove-file-artifacts=false image-overrides=map[] entrypoint=[] (false) cmd=[] (false) workdir='' env=[] expose=map[]" app=docker-slim command=build cmd=build info=app container='false' dsimage='false' location='/usr/local/bin' cmd='build' version='darwin|Transformer|1.39.0|latest|latest' cmd=build info=host osbuild='22C65' version=' Fri Nov 11 02:08:47 PST 2022; root:xnu-8792.61.2~4/RELEASE_X86_64' release='22.2.0' sysname='darwin' cmd='build' osname='other' cmd=build info=docker cmd='build' name='default' kernel.version='4.19.130-boot2docker' operating.system='Boot2Docker 19.03.12 (TCL 10.1)' ostype='linux' server.version='19.03.12' architecture='x86_64' cmd=build info=dclient build.time='2020-06-22T15:49:35.000000000+00:00' git.commit='48a66213fe' cmd='build' api.version='1.40' mini.api.version='1.12' cmd=build state=image.inspection.start time="2022-12-27T17:22:23-07:00" level=info msg="inspecting 'fat' image metadata..." app=docker-slim command=build time="2022-12-27T17:22:23-07:00" level=debug msg="PrepareImageStateDirs(,sha256:4c9bff646815b2c4a43633af4925cc61270bea6ac95db6c459287b6ff1bd4d93)" time="2022-12-27T17:22:23-07:00" level=debug msg="PrepareImageStateDirs - statePrefix=/usr/local/bin appDir=/usr/local/bin badPath=/usr/local/bin" time="2022-12-27T17:22:23-07:00" level=debug msg="PrepareImageStateDirs - overriding state path to /tmp/docker-slim-state" time="2022-12-27T17:22:23-07:00" level=debug msg="PrepareImageStateDirs - statePrefix=/tmp/docker-slim-state appDir=/usr/local/bin badPath=/usr/local/bin" time="2022-12-27T17:22:23-07:00" level=debug msg="PrepareImageStateDirs - copying sensor to state path (to /tmp/docker-slim-state)" time="2022-12-27T17:22:23-07:00" level=debug msg="CopyRegularFile(false,/usr/local/bin/docker-slim-sensor,/tmp/docker-slim-state/docker-slim-sensor,true)" time="2022-12-27T17:22:23-07:00" level=debug msg="PrepareImageStateDirs - removing existing state location: /tmp/docker-slim-state/.docker-slim-state/images/4c9bff646815b2c4a43633af4925cc61270bea6ac95db6c459287b6ff1bd4d93/artifacts" time="2022-12-27T17:22:23-07:00" level=debug msg="PrepareImageStateDirs - created new image state location: /tmp/docker-slim-state/.docker-slim-state/images/4c9bff646815b2c4a43633af4925cc61270bea6ac95db6c459287b6ff1bd4d93/artifacts" time="2022-12-27T17:22:23-07:00" level=debug msg="localVolumePath=/tmp/docker-slim-state/.docker-slim-state/images/4c9bff646815b2c4a43633af4925cc61270bea6ac95db6c459287b6ff1bd4d93, artifactLocation=/tmp/docker-slim-state/.docker-slim-state/images/4c9bff646815b2c4a43633af4925cc61270bea6ac95db6c459287b6ff1bd4d93/artifacts, statePath=/tmp/docker-slim-state, stateKey=4c9bff646815b2c4a43633af4925cc61270bea6ac95db6c459287b6ff1bd4d93" app=docker-slim command=build cmd=build info=image size.bytes='954012097' size.human='954 MB' id='sha256:4c9bff646815b2c4a43633af4925cc61270bea6ac95db6c459287b6ff1bd4d93' time="2022-12-27T17:22:23-07:00" level=info msg="processing 'fat' image info..." app=docker-slim command=build time="2022-12-27T17:22:23-07:00" level=debug msg="\n\nIMAGE HISTORY =>\n[]docker.ImageHistory{docker.ImageHistory{ID:\"sha256:4c9bff646815b2c4a43633af4925cc61270bea6ac95db6c459287b6ff1bd4d93\", Tags:[]string{\"hello-world-python:latest\"}, Created:1672186011, CreatedBy:\"/bin/sh -c #(nop) CMD [\\\"python\\\" \\\"./helloworld.py\\\"]\", Size:0, Comment:\"\"}, docker.ImageHistory{ID:\"sha256:5041e3ae0e16cf067dc7fae37c9fae5ec1e86a2f4e3b6b6402acad8c820af398\", Tags:[]string(nil), Created:1672186010, CreatedBy:\"/bin/sh -c #(nop) EXPOSE 3000\", Size:0, Comment:\"\"}, docker.ImageHistory{ID:\"sha256:1de0cca84141a13dfe4763761c26f2847fa9663b05a87cfd118623678f1275c0\", Tags:[]string(nil), Created:1672186010, CreatedBy:\"/bin/sh -c pip install flask_restful\", Size:2687730, Comment:\"\"}, docker.ImageHistory{ID:\"sha256:93912aad3157ec8fe403cebbc76461c9fc1fc81854bfe26ecc8a53d87678d33b\", Tags:[]string(nil), Created:1672186008, CreatedBy:\"/bin/sh -c pip install flask\", Size:19526376, Comment:\"\"}, docker.ImageHistory{ID:\"sha256:ab89ad1cfde54009d37e38c838391bc55486b3fb735357586eafc2b4a28e9f0e\", Tags:[]string(nil), Created:1672186003, CreatedBy:\"/bin/sh -c #(nop) ADD file:084979ddba9db3e62516a7493bfbf53499de3da988545ec835c92f935735846d in / \", Size:292, Comment:\"\"}, docker.ImageHistory{ID:\"sha256:75cc8d87cc34bdb26dfcbe6c9e4483d9b483761510b5069852f52bd8431b8012\", Tags:[]string{\"python:3\"}, Created:1671647810, CreatedBy:\"/bin/sh -c #(nop) CMD [\\\"python3\\\"]\", Size:0, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671647810, CreatedBy:\"/bin/sh -c set -eux; \\t\\twget -O get-pip.py \\\"$PYTHON_GET_PIP_URL\\\"; \\techo \\\"$PYTHON_GET_PIP_SHA256 *get-pip.py\\\" | sha256sum -c -; \\t\\texport PYTHONDONTWRITEBYTECODE=1; \\t\\tpython get-pip.py \\t\\t--disable-pip-version-check \\t\\t--no-cache-dir \\t\\t--no-compile \\t\\t\\\"pip==$PYTHON_PIP_VERSION\\\" \\t\\t\\\"setuptools==$PYTHON_SETUPTOOLS_VERSION\\\" \\t; \\trm -f get-pip.py; \\t\\tpip --version\", Size:10888898, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671647804, CreatedBy:\"/bin/sh -c #(nop) ENV PYTHON_GET_PIP_SHA256=1e501cf004eac1b7eb1f97266d28f995ae835d30250bec7f8850562703067dc6\", Size:0, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671647804, CreatedBy:\"/bin/sh -c #(nop) ENV PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/66030fa03382b4914d4c4d0896961a0bdeeeb274/public/get-pip.py\", Size:0, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671647804, CreatedBy:\"/bin/sh -c #(nop) ENV PYTHON_SETUPTOOLS_VERSION=65.5.0\", Size:0, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671647804, CreatedBy:\"/bin/sh -c #(nop) ENV PYTHON_PIP_VERSION=22.3.1\", Size:0, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671647804, CreatedBy:\"/bin/sh -c set -eux; \\tfor src in idle3 pydoc3 python3 python3-config; do \\t\\tdst=\\\"$(echo \\\"$src\\\" | tr -d 3)\\\"; \\t\\t[ -s \\\"/usr/local/bin/$src\\\" ]; \\t\\t[ ! -e \\\"/usr/local/bin/$dst\\\" ]; \\t\\tln -svT \\\"$src\\\" \\\"/usr/local/bin/$dst\\\"; \\tdone\", Size:32, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671647803, CreatedBy:\"/bin/sh -c set -eux; \\t\\twget -O python.tar.xz \\\"https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz\\\"; \\twget -O python.tar.xz.asc \\\"https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc\\\"; \\tGNUPGHOME=\\\"$(mktemp -d)\\\"; export GNUPGHOME; \\tgpg --batch --keyserver hkps://keys.openpgp.org --recv-keys \\\"$GPG_KEY\\\"; \\tgpg --batch --verify python.tar.xz.asc python.tar.xz; \\tcommand -v gpgconf > /dev/null && gpgconf --kill all || :; \\trm -rf \\\"$GNUPGHOME\\\" python.tar.xz.asc; \\tmkdir -p /usr/src/python; \\ttar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \\trm python.tar.xz; \\t\\tcd /usr/src/python; \\tgnuArch=\\\"$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)\\\"; \\t./configure \\t\\t--build=\\\"$gnuArch\\\" \\t\\t--enable-loadable-sqlite-extensions \\t\\t--enable-optimizations \\t\\t--enable-option-checking=fatal \\t\\t--enable-shared \\t\\t--with-lto \\t\\t--with-system-expat \\t\\t--without-ensurepip \\t; \\tnproc=\\\"$(nproc)\\\"; \\tmake -j \\\"$nproc\\\" \\t; \\tmake install; \\t\\tbin=\\\"$(readlink -ve /usr/local/bin/python3)\\\"; \\tdir=\\\"$(dirname \\\"$bin\\\")\\\"; \\tmkdir -p \\\"/usr/share/gdb/auto-load/$dir\\\"; \\tcp -vL Tools/gdb/libpython.py \\\"/usr/share/gdb/auto-load/$bin-gdb.py\\\"; \\t\\tcd /; \\trm -rf /usr/src/python; \\t\\tfind /usr/local -depth \\t\\t\\\\( \\t\\t\\t\\\\( -type d -a \\\\( -name test -o -name tests -o -name idle_test \\\\) \\\\) \\t\\t\\t-o \\\\( -type f -a \\\\( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \\\\) \\\\) \\t\\t\\\\) -exec rm -rf '{}' + \\t; \\t\\tldconfig; \\t\\tpython3 --version\", Size:67749804, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671646969, CreatedBy:\"/bin/sh -c #(nop) ENV PYTHON_VERSION=3.11.1\", Size:0, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671646969, CreatedBy:\"/bin/sh -c #(nop) ENV GPG_KEY=A035C8C19219BA821ECEA86B64E628F8D684696D\", Size:0, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671645270, CreatedBy:\"/bin/sh -c set -eux; \\tapt-get update; \\tapt-get install -y --no-install-recommends \\t\\tlibbluetooth-dev \\t\\ttk-dev \\t\\tuuid-dev \\t; \\trm -rf /var/lib/apt/lists/*\", Size:18482051, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671645265, CreatedBy:\"/bin/sh -c #(nop) ENV LANG=C.UTF-8\", Size:0, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671645265, CreatedBy:\"/bin/sh -c #(nop) ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\", Size:0, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671621331, CreatedBy:\"/bin/sh -c set -ex; \\tapt-get update; \\tapt-get install -y --no-install-recommends \\t\\tautoconf \\t\\tautomake \\t\\tbzip2 \\t\\tdpkg-dev \\t\\tfile \\t\\tg++ \\t\\tgcc \\t\\timagemagick \\t\\tlibbz2-dev \\t\\tlibc6-dev \\t\\tlibcurl4-openssl-dev \\t\\tlibdb-dev \\t\\tlibevent-dev \\t\\tlibffi-dev \\t\\tlibgdbm-dev \\t\\tlibglib2.0-dev \\t\\tlibgmp-dev \\t\\tlibjpeg-dev \\t\\tlibkrb5-dev \\t\\tliblzma-dev \\t\\tlibmagickcore-dev \\t\\tlibmagickwand-dev \\t\\tlibmaxminddb-dev \\t\\tlibncurses5-dev \\t\\tlibncursesw5-dev \\t\\tlibpng-dev \\t\\tlibpq-dev \\t\\tlibreadline-dev \\t\\tlibsqlite3-dev \\t\\tlibssl-dev \\t\\tlibtool \\t\\tlibwebp-dev \\t\\tlibxml2-dev \\t\\tlibxslt-dev \\t\\tlibyaml-dev \\t\\tmake \\t\\tpatch \\t\\tunzip \\t\\txz-utils \\t\\tzlib1g-dev \\t\\t\\t\\t$( \\t\\t\\tif apt-cache show 'default-libmysqlclient-dev' 2>/dev/null | grep -q '^Version:'; then \\t\\t\\t\\techo 'default-libmysqlclient-dev'; \\t\\t\\telse \\t\\t\\t\\techo 'libmysqlclient-dev'; \\t\\t\\tfi \\t\\t) \\t; \\trm -rf /var/lib/apt/lists/*\", Size:528983070, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671621257, CreatedBy:\"/bin/sh -c apt-get update && apt-get install -y --no-install-recommends \\t\\tgit \\t\\tmercurial \\t\\topenssh-client \\t\\tsubversion \\t\\t\\t\\tprocps \\t&& rm -rf /var/lib/apt/lists/*\", Size:151952345, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671621238, CreatedBy:\"/bin/sh -c set -ex; \\tif ! command -v gpg > /dev/null; then \\t\\tapt-get update; \\t\\tapt-get install -y --no-install-recommends \\t\\t\\tgnupg \\t\\t\\tdirmngr \\t\\t; \\t\\trm -rf /var/lib/apt/lists/*; \\tfi\", Size:18952036, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671621231, CreatedBy:\"/bin/sh -c set -eux; \\tapt-get update; \\tapt-get install -y --no-install-recommends \\t\\tca-certificates \\t\\tcurl \\t\\tnetbase \\t\\twget \\t; \\trm -rf /var/lib/apt/lists/*\", Size:10696879, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671585622, CreatedBy:\"/bin/sh -c #(nop) CMD [\\\"bash\\\"]\", Size:0, Comment:\"\"}, docker.ImageHistory{ID:\"\", Tags:[]string(nil), Created:1671585621, CreatedBy:\"/bin/sh -c #(nop) ADD file:c13b430c8699df107ffd9ea5230b92238bc037a8e1cbbe35d6ab664941d575da in / \", Size:124092584, Comment:\"\"}}\n\n" time="2022-12-27T17:22:23-07:00" level=debug msg="IMAGE INSTRUCTIONS:" time="2022-12-27T17:22:23-07:00" level=debug msg="FROM scratch" time="2022-12-27T17:22:23-07:00" level=debug msg="# new image" time="2022-12-27T17:22:23-07:00" level=debug msg="ADD file:c13b430c8699df107ffd9ea5230b92238bc037a8e1cbbe35d6ab664941d575da /" time="2022-12-27T17:22:23-07:00" level=debug msg="CMD [\"bash\"]\n" time="2022-12-27T17:22:23-07:00" level=debug msg="RUN set -eux; \tapt-get update; \tapt-get install -y --no-install-recommends \t\tca-certificates \t\tcurl \t\tnetbase \t\twget \t; \trm -rf /var/lib/apt/lists/*" time="2022-12-27T17:22:23-07:00" level=debug msg="RUN set -ex; \tif ! command -v gpg > /dev/null; then \t\tapt-get update; \t\tapt-get install -y --no-install-recommends \t\t\tgnupg \t\t\tdirmngr \t\t; \t\trm -rf /var/lib/apt/lists/*; \tfi" time="2022-12-27T17:22:23-07:00" level=debug msg="RUN apt-get update && \\\n\tapt-get install -y --no-install-recommends \t\tgit \t\tmercurial \t\topenssh-client \t\tsubversion \t\t\t\tprocps && \\\n\trm -rf /var/lib/apt/lists/*" time="2022-12-27T17:22:23-07:00" level=debug msg="RUN set -ex; \tapt-get update; \tapt-get install -y --no-install-recommends \t\tautoconf \t\tautomake \t\tbzip2 \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\timagemagick \t\tlibbz2-dev \t\tlibc6-dev \t\tlibcurl4-openssl-dev \t\tlibdb-dev \t\tlibevent-dev \t\tlibffi-dev \t\tlibgdbm-dev \t\tlibglib2.0-dev \t\tlibgmp-dev \t\tlibjpeg-dev \t\tlibkrb5-dev \t\tliblzma-dev \t\tlibmagickcore-dev \t\tlibmagickwand-dev \t\tlibmaxminddb-dev \t\tlibncurses5-dev \t\tlibncursesw5-dev \t\tlibpng-dev \t\tlibpq-dev \t\tlibreadline-dev \t\tlibsqlite3-dev \t\tlibssl-dev \t\tlibtool \t\tlibwebp-dev \t\tlibxml2-dev \t\tlibxslt-dev \t\tlibyaml-dev \t\tmake \t\tpatch \t\tunzip \t\txz-utils \t\tzlib1g-dev \t\t\t\t$( \t\t\tif apt-cache show 'default-libmysqlclient-dev' 2>/dev/null | grep -q '^Version:'; then \t\t\t\techo 'default-libmysqlclient-dev'; \t\t\telse \t\t\t\techo 'libmysqlclient-dev'; \t\t\tfi \t\t) \t; \trm -rf /var/lib/apt/lists/*" time="2022-12-27T17:22:23-07:00" level=debug msg="ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" time="2022-12-27T17:22:23-07:00" level=debug msg="ENV LANG=C.UTF-8" time="2022-12-27T17:22:23-07:00" level=debug msg="RUN set -eux; \tapt-get update; \tapt-get install -y --no-install-recommends \t\tlibbluetooth-dev \t\ttk-dev \t\tuuid-dev \t; \trm -rf /var/lib/apt/lists/*" time="2022-12-27T17:22:23-07:00" level=debug msg="ENV GPG_KEY=A035C8C19219BA821ECEA86B64E628F8D684696D" time="2022-12-27T17:22:23-07:00" level=debug msg="ENV PYTHON_VERSION=3.11.1" time="2022-12-27T17:22:23-07:00" level=debug msg="RUN set -eux; \t\twget -O python.tar.xz \"https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz\"; \twget -O python.tar.xz.asc \"https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc\"; \tGNUPGHOME=\"$(mktemp -d)\"; export GNUPGHOME; \tgpg --batch --keyserver hkps://keys.openpgp.org --recv-keys \"$GPG_KEY\"; \tgpg --batch --verify python.tar.xz.asc python.tar.xz; \tcommand -v gpgconf > /dev/null && \\\n\tgpgconf --kill all || :; \trm -rf \"$GNUPGHOME\" python.tar.xz.asc; \tmkdir -p /usr/src/python; \ttar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \trm python.tar.xz; \t\tcd /usr/src/python; \tgnuArch=\"$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)\"; \t./configure \t\t--build=\"$gnuArch\" \t\t--enable-loadable-sqlite-extensions \t\t--enable-optimizations \t\t--enable-option-checking=fatal \t\t--enable-shared \t\t--with-lto \t\t--with-system-expat \t\t--without-ensurepip \t; \tnproc=\"$(nproc)\"; \tmake -j \"$nproc\" \t; \tmake install; \t\tbin=\"$(readlink -ve /usr/local/bin/python3)\"; \tdir=\"$(dirname \"$bin\")\"; \tmkdir -p \"/usr/share/gdb/auto-load/$dir\"; \tcp -vL Tools/gdb/libpython.py \"/usr/share/gdb/auto-load/$bin-gdb.py\"; \t\tcd /; \trm -rf /usr/src/python; \t\tfind /usr/local -depth \t\t\\( \t\t\t\\( -type d -a \\( -name test -o -name tests -o -name idle_test \\) \\) \t\t\t-o \\( -type f -a \\( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \\) \\) \t\t\\) -exec rm -rf '{}' + \t; \t\tldconfig; \t\tpython3 --version" time="2022-12-27T17:22:23-07:00" level=debug msg="RUN set -eux; \tfor src in idle3 pydoc3 python3 python3-config; do \t\tdst=\"$(echo \"$src\" | tr -d 3)\"; \t\t[ -s \"/usr/local/bin/$src\" ]; \t\t[ ! -e \"/usr/local/bin/$dst\" ]; \t\tln -svT \"$src\" \"/usr/local/bin/$dst\"; \tdone" time="2022-12-27T17:22:23-07:00" level=debug msg="ENV PYTHON_PIP_VERSION=22.3.1" time="2022-12-27T17:22:23-07:00" level=debug msg="ENV PYTHON_SETUPTOOLS_VERSION=65.5.0" time="2022-12-27T17:22:23-07:00" level=debug msg="ENV PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/66030fa03382b4914d4c4d0896961a0bdeeeb274/public/get-pip.py" time="2022-12-27T17:22:23-07:00" level=debug msg="ENV PYTHON_GET_PIP_SHA256=1e501cf004eac1b7eb1f97266d28f995ae835d30250bec7f8850562703067dc6" time="2022-12-27T17:22:23-07:00" level=debug msg="RUN set -eux; \t\twget -O get-pip.py \"$PYTHON_GET_PIP_URL\"; \techo \"$PYTHON_GET_PIP_SHA256 *get-pip.py\" | sha256sum -c -; \t\texport PYTHONDONTWRITEBYTECODE=1; \t\tpython get-pip.py \t\t--disable-pip-version-check \t\t--no-cache-dir \t\t--no-compile \t\t\"pip==$PYTHON_PIP_VERSION\" \t\t\"setuptools==$PYTHON_SETUPTOOLS_VERSION\" \t; \trm -f get-pip.py; \t\tpip --version" time="2022-12-27T17:22:23-07:00" level=debug msg="CMD [\"python3\"]\n" time="2022-12-27T17:22:23-07:00" level=debug msg="# end of image: python:3 (id: tags: python:3)" time="2022-12-27T17:22:23-07:00" level=debug time="2022-12-27T17:22:23-07:00" level=debug msg="# new image" time="2022-12-27T17:22:23-07:00" level=debug msg="ADD file:084979ddba9db3e62516a7493bfbf53499de3da988545ec835c92f935735846d /" time="2022-12-27T17:22:23-07:00" level=debug msg="RUN pip install flask" time="2022-12-27T17:22:23-07:00" level=debug msg="RUN pip install flask_restful" time="2022-12-27T17:22:23-07:00" level=debug msg="EXPOSE 3000" time="2022-12-27T17:22:23-07:00" level=debug msg="CMD [\"python\",\"./helloworld.py\"]\n" time="2022-12-27T17:22:23-07:00" level=debug msg="# end of image: hello-world-python:latest (id: tags: hello-world-python:latest)" time="2022-12-27T17:22:23-07:00" level=debug cmd=build info=image.stack index='0' name='python:3' id='sha256:75cc8d87cc34bdb26dfcbe6c9e4483d9b483761510b5069852f52bd8431b8012' cmd=build info=image.stack index='1' name='hello-world-python:latest' id='sha256:4c9bff646815b2c4a43633af4925cc61270bea6ac95db6c459287b6ff1bd4d93' cmd=build info=image.exposed_ports list='3000' cmd=build state=image.inspection.done cmd=build state=container.inspection.start time="2022-12-27T17:22:23-07:00" level=debug msg="FatContainerCmd - [python ./helloworld.py]" app=docker-slim command=build component=container.inspector time="2022-12-27T17:22:23-07:00" level=info msg="starting instrumented 'fat' container..." app=docker-slim command=build time="2022-12-27T17:22:23-07:00" level=debug msg="RunContainer: sensor (/tmp/docker-slim-state/docker-slim-sensor) perms => 0777" app=docker-slim command=build component=container.inspector time="2022-12-27T17:22:23-07:00" level=debug msg="ensureSensorVolume: already have volume = docker-slim-sensor.1.39.0" app=docker-slim command=build component=container.inspector time="2022-12-27T17:22:23-07:00" level=debug msg="RunContainer: default exposed ports => map[docker.Port]struct {}{\"65501/tcp\":struct {}{}, \"65502/tcp\":struct {}{}}" app=docker-slim command=build component=container.inspector time="2022-12-27T17:22:23-07:00" level=debug msg="RunContainer: HostConfig.PublishAllPorts => true" app=docker-slim command=build component=container.inspector cmd=build info=container status='created' name='dockerslimk_13774_20221228002223' id='d7de46adb8fd07a93a790e19138d0d763f0b7360ac085521f62048592488c499' time="2022-12-27T17:22:24-07:00" level=debug msg="version.Check: http status = 200 OK" app=docker-slim time="2022-12-27T17:22:24-07:00" level=debug msg="RunContainer: container HostConfig.NetworkMode => default len(ports)=3" app=docker-slim command=build component=container.inspector time="2022-12-27T17:22:24-07:00" level=debug msg="RunContainer: container NetworkSettings.Ports => map[docker.Port][]docker.PortBinding{\"3000/tcp\":[]docker.PortBinding{docker.PortBinding{HostIP:\"0.0.0.0\", HostPort:\"32820\"}}, \"65501/tcp\":[]docker.PortBinding{docker.PortBinding{HostIP:\"0.0.0.0\", HostPort:\"32819\"}}, \"65502/tcp\":[]docker.PortBinding{docker.PortBinding{HostIP:\"0.0.0.0\", HostPort:\"32818\"}}}" app=docker-slim command=build component=container.inspector cmd=build info=container status='running' name='dockerslimk_13774_20221228002223' id='d7de46adb8fd07a93a790e19138d0d763f0b7360ac085521f62048592488c499' cmd=build info=container message='obtained IP address' ip='172.17.0.3' time="2022-12-27T17:22:24-07:00" level=debug msg=target.container.ipc.connect app=docker-slim command=build component=container.inspector container.network= in.container=false ipc.mode=proxy op=container.Inspector.initContainerChannels port.cmd=32819 port.evt=32818 target=192.168.99.100 time="2022-12-27T17:22:24-07:00" level=debug msg="ipc.NewClient(192.168.99.100,32819,32818)" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.NewClient: connect wait timeout - 1m0s" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.NewClient: net.DialTimeout(tcp,192.168.99.100:32819,15s) [time=1672186944106111000]" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.Client.Write: remote=192.168.99.100:32819 -> local=192.168.99.1:55629 - conn.Write wc=75 err= [time=1672186944106995000]" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.Client.Read() - (0xc00010f260)reader.ReadString => err= raw=\"[<|]{\\\"tid\\\":\\\"1672186944106907000.52fdfc072182654f\\\",\\\"type\\\":\\\"ft.control\\\"}[|>]\\n\"" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.Client.Read: got raw frame ='[<|]{\"tid\":\"1672186944106907000.52fdfc072182654f\",\"type\":\"ft.control\"}[|>]\n'" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.Client.Read: frame data => tid=1672186944106907000.52fdfc072182654f type=ft.control body=''" time="2022-12-27T17:22:24-07:00" level=debug msg="verifyCommandChannel: client.Read() (tid=1672186944106907000.52fdfc072182654f type=ft.control) result.data=''" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.NewClient: connect wait timeout - 1m0s" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.NewClient: net.DialTimeout(tcp,192.168.99.100:32818,15s) [time=1672186944108301000]" time="2022-12-27T17:22:24-07:00" level=debug msg="ipc.Client.SendCommand() cmd channel call data='{\"name\":\"cmd.monitor.start\",\"data\":{\"rta_source_ptrace\":true,\"app_name\":\"python\",\"app_args\":[\"./helloworld.py\"],\"app_stdout_to_file\":false,\"app_stderr_to_file\":false,\"report_on_main_pid_exit\":false,\"keep_perms\":true,\"include_cert_all\":true,\"include_new\":true}}'\n" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.CommandClient.Call: calling c.Write()" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.Client.Write: remote=192.168.99.100:32819 -> local=192.168.99.1:55629 - conn.Write wc=343 err= [time=1672186944109240000]" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.CommandClient.Call: calling c.Read()" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.Client.Read() - (0xc00010f260)reader.ReadString => err= raw=\"[<|]{\\\"tid\\\":\\\"1672186944109183000.163f5f0f9a621d72\\\",\\\"type\\\":\\\"ft.response\\\",\\\"body\\\":{\\\"status\\\":\\\"ok\\\"}}[|>]\\n\"" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.Client.Read: got raw frame ='[<|]{\"tid\":\"1672186944109183000.163f5f0f9a621d72\",\"type\":\"ft.response\",\"body\":{\"status\":\"ok\"}}[|>]\n'" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.Client.Read: frame data => tid=1672186944109183000.163f5f0f9a621d72 type=ft.response body='{\"status\":\"ok\"}'" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.CommandClient.Call: c.Read() (tid=1672186944109183000.163f5f0f9a621d72 type=ft.response) result.data='{\"status\":\"ok\"}'" time="2022-12-27T17:22:24-07:00" level=debug msg="ipc.Client.SendCommand() cmd channel call response='{\"status\":\"ok\"}'\n" cmd=build info=cmd.startmonitor status='sent' time="2022-12-27T17:22:24-07:00" level=debug msg="channel.Client.Read() - (0xc0004a10e0)reader.ReadString => err= raw=\"[<|]{\\\"tid\\\":\\\"1672186944430355124.52fdfc072182654f\\\",\\\"type\\\":\\\"ft.event\\\",\\\"body\\\":{\\\"name\\\":\\\"event.monitor.start.failed\\\",\\\"data\\\":null}}[|>]\\n\"" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.Client.Read: got raw frame ='[<|]{\"tid\":\"1672186944430355124.52fdfc072182654f\",\"type\":\"ft.event\",\"body\":{\"name\":\"event.monitor.start.failed\",\"data\":null}}[|>]\n'" time="2022-12-27T17:22:24-07:00" level=debug msg="channel.Client.Read: frame data => tid=1672186944430355124.52fdfc072182654f type=ft.event body='{\"name\":\"event.monitor.start.failed\",\"data\":null}'" time="2022-12-27T17:22:24-07:00" level=debug msg="ipc.Client.GetEvent(): channel.Recv() - done [tid=1672186944430355124.52fdfc072182654f evt={\"name\":\"event.monitor.start.failed\",\"data\":null}]\n" cmd=build info=event.startmonitor.done status='received.unexpected' data='&{Name:event.monitor.start.failed Data:}' cmd=build info=report file='slim.report.json' time="2022-12-27T17:22:24-07:00" level=fatal msg="docker-slim: failure" error="unexpected event type" stack="goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x65\ngithub.com/docker-slim/docker-slim/pkg/util/errutil.FailOn({0x2a8f160, 0xc000432c60})\n\tgithub.com/docker-slim/docker-slim/pkg/util/errutil/errutil.go:28 +0x5e\ngithub.com/docker-slim/docker-slim/pkg/app.(*ExecutionContext).FailOn(0xc00024c2c0?, {0x2a8f160?, 0xc000432c60?})\n\tgithub.com/docker-slim/docker-slim/pkg/app/execontext.go:56 +0x49\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.OnCommand(_, _, {_, _}, _, {_, _}, {_, _}, {0x0, ...}, ...)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/handler.go:876 +0x456b\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.glob..func1(0xc0007c8900)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/cli.go:607 +0x4730\ngithub.com/urfave/cli/v2.(*Command).Run(0x3865720, 0xc000612500)\n\tgithub.com/urfave/cli/v2@v2.3.0/command.go:163 +0x5dc\ngithub.com/urfave/cli/v2.(*App).RunContext(0xc00024a000, {0x2aa85d0?, 0xc000122008}, {0xc000128000, 0x5, 0x5})\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:313 +0xb7d\ngithub.com/urfave/cli/v2.(*App).Run(...)\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:224\ngithub.com/docker-slim/docker-slim/pkg/app/master.Run()\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/app.go:15 +0x46\nmain.main()\n\tgithub.com/docker-slim/docker-slim/cmd/docker-slim/main.go:15 +0x18e\n" version="darwin|Transformer|1.39.0|latest|latest"`
itsekhmistro commented 1 year ago

Same issue. level=fatal msg="docker-slim: failure" error="unexpected event type" stack="...... github.com/docker-slim/docker-slim/pkg/app/master/commands/build/handler.go:876...`

Platform: Mac OS 13.1 Apple M1 Pro

docker version: Client: Cloud integration: v1.0.29 Version: 20.10.21 API version: 1.41 Go version: go1.18.7 Git commit: baeda1f Built: Tue Oct 25 18:01:18 2022 OS/Arch: darwin/arm64 Context: default Experimental: true

smpurkis commented 1 year ago

likewise

level=fatal msg="docker-slim: failure" error="unexpected event type"...

Platform: Mac OS 13.0 Apple M1 Max

Docker Version: Client: Cloud integration: v1.0.29 Version: 20.10.17 API version: 1.41 Go version: go1.17.11 Git commit: 100c701 Built: Mon Jun 6 23:04:45 2022 OS/Arch: darwin/arm64 Context: default Experimental: true

Server: Docker Desktop 4.12.0 (85629) Engine: Version: 20.10.17 API version: 1.41 (minimum version 1.12) Go version: go1.17.11 Git commit: a89b842 Built: Mon Jun 6 23:01:01 2022 OS/Arch: linux/arm64 Experimental: false containerd: Version: 1.6.8 GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6 runc: Version: 1.1.4 GitCommit: v1.1.4-0-g5fd4c4d docker-init: Version: 0.19.0 GitCommit: de40ad0

Simpler steps to reproduce:

  1. docker pull nginx:latest
  2. docker-slim build --target nginx:latest
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=param.http.probe message='using default probe' 
cmd=build state=started
cmd=build info=params target='nginx:latest' continue.mode='probe' rt.as.user='true' keep.perms='true' tags='' target.type='image' 
cmd=build state=image.inspection.start
time="2023-02-10T16:51:47Z" level=fatal msg="docker-slim: failure" error="unlinkat /opt/homebrew/bin/.docker-slim-state/images/8a5e3e44915c98a8063d87f2b18d79ab86b80eae45df2e2cde4e32298b89e7b9/artifacts/Dockerfile.fat: permission denied" stack="goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x65\ngithub.com/docker-slim/docker-slim/pkg/util/errutil.FailOn({0x2a90c00, 0xc0006d8b70})\n\tgithub.com/docker-slim/docker-slim/pkg/util/errutil/errutil.go:28 +0x5e\ngithub.com/docker-slim/docker-slim/pkg/util/fsutil.PrepareImageStateDirs({0x0, 0x0}, {0xc00015c0a0, 0x47})\n\tgithub.com/docker-slim/docker-slim/pkg/util/fsutil/fsutil.go:1014 +0xb8d\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.inspectFatImage(0xc000092520, {0x2081bd1f3, 0xc}, 0x0, 0x0?, 0x0, {0x0, 0x0}, {0x0, 0x0}, ...)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/image.go:81 +0x7c5\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.OnCommand(_, _, {_, _}, _, {_, _}, {_, _}, {0x0, ...}, ...)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/handler.go:599 +0x2a3a\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.glob..func1(0xc00003f480)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/cli.go:607 +0x4730\ngithub.com/urfave/cli/v2.(*Command).Run(0x38657c0, 0xc0000d85c0)\n\tgithub.com/urfave/cli/v2@v2.3.0/command.go:163 +0x5dc\ngithub.com/urfave/cli/v2.(*App).RunContext(0xc000103040, {0x2aa7b10?, 0xc0000500a8}, {0xc00003e080, 0x4, 0x4})\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:313 +0xb7d\ngithub.com/urfave/cli/v2.(*App).Run(...)\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:224\ngithub.com/docker-slim/docker-slim/pkg/app/master.Run()\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/app.go:15 +0x46\nmain.main()\n\tgithub.com/docker-slim/docker-slim/cmd/docker-slim/main.go:15 +0x18e\n" version="darwin|Transformer|1.39.1|537c77323f2e9a3d6771aa0ea73a047017774d16|2022-11-13_03:27:40AM"
shablipapu commented 1 year ago

I'm getting this issue too. version 1.40

level=fatal msg="docker-slim: failure" error="unexpected event type" stack="goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x65\ngithub.com/docker-slim/docker-slim/pkg/util/errutil.FailOn({0x1edf700, 0xc000422c60})\n\tgithub.com/docker-slim/docker-slim/pkg/util/errutil/errutil.go:28 +0x5e\ngithub.com/docker-slim/docker-slim/pkg/app.(*ExecutionContext).FailOn(0xc0001aedc0?, {0x1edf700?, 0xc000422c60?})\n\tgithub.com/docker-slim/docker-slim/pkg/app/execontext.go:56 +0x49\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.OnCommand(_, _, {_, _}, _, {_, _}, {_, _}, {0x0, ...}, ...)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/handler.go:879 +0x422b\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.glob..func1(0xc0000daa00)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/cli.go:640 +0x4bb0\ngithub.com/urfave/cli/v2.(*Command).Run(0x2cd6580, 0xc0000b25c0)\n\tgithub.com/urfave/cli/v2@v2.3.0/command.go:163 +0x5dc\ngithub.com/urfave/cli/v2.(*App).RunContext(0xc000007520, {0x1ef8d70?, 0xc000124000}, {0xc00011a000, 0x10, 0x10})\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:313 +0xb7d\ngithub.com/urfave/cli/v2.(*App).Run(...)\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:224\ngithub.com/docker-slim/docker-slim/pkg/app/master.Run()\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/app.go:15 +0x46\nmain.main()\n\tgithub.com/docker-slim/docker-slim/cmd/slim/main.go:15 +0x18e\n" version="linux|Transformer|1.40.0|a4bb798922820523fceedb9121f5bcfdfc9f2901|2023-01-15_09:42:23PM"

btorsaldivar commented 1 year ago

I'm getting this issue too. version 1.40

level=fatal msg="docker-slim: failure" error="unexpected event type" stack="goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x65\ngithub.com/docker-slim/docker-slim/pkg/util/errutil.FailOn({0x1edf700, 0xc000422c60})\n\tgithub.com/docker-slim/docker-slim/pkg/util/errutil/errutil.go:28 +0x5e\ngithub.com/docker-slim/docker-slim/pkg/app.(*ExecutionContext).FailOn(0xc0001aedc0?, {0x1edf700?, 0xc000422c60?})\n\tgithub.com/docker-slim/docker-slim/pkg/app/execontext.go:56 +0x49\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.OnCommand(_, _, {_, _}, _, {_, _}, {_, _}, {0x0, ...}, ...)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/handler.go:879 +0x422b\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.glob..func1(0xc0000daa00)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/cli.go:640 +0x4bb0\ngithub.com/urfave/cli/v2.(*Command).Run(0x2cd6580, 0xc0000b25c0)\n\tgithub.com/urfave/cli/v2@v2.3.0/command.go:163 +0x5dc\ngithub.com/urfave/cli/v2.(*App).RunContext(0xc000007520, {0x1ef8d70?, 0xc000124000}, {0xc00011a000, 0x10, 0x10})\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:313 +0xb7d\ngithub.com/urfave/cli/v2.(*App).Run(...)\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:224\ngithub.com/docker-slim/docker-slim/pkg/app/master.Run()\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/app.go:15 +0x46\nmain.main()\n\tgithub.com/docker-slim/docker-slim/cmd/slim/main.go:15 +0x18e\n" version="linux|Transformer|1.40.0|a4bb798922820523fceedb9121f5bcfdfc9f2901|2023-01-15_09:42:23PM"

I'm having exactly the same issue, using Colima on MacOS

❯ slim --version
slim version darwin|Transformer|1.40.0|latest|latest
❯ docker info
Client:
 Context:    colima
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 19
 Server Version: 20.10.20
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
 runc version: 5fd4c4d144137e991c4acebb2146ab1483a97925
 init version:
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.15.82-0-virt
 Operating System: Alpine Linux v3.16
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 1.938GiB
 Name: colima
 ID: T7GZ:P2ZQ:6QML:JXS4:VHD4:GRCD:YN24:4SFU:B4QJ:L7BR:SJZF:P5BR
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
kcq commented 1 year ago

Looks like the sensor monitors in the temporary container fails to start ('event.monitor.start.failed' event indicates that). We don't know why though. For that we need to get the temporary container logs. You can get those by adding the --show-clogs build command flag. You can also get them directly using the docker logs command.

btorsaldivar commented 1 year ago

That's correct, looks like the issue is with the fanotify not starting properly. There's a related thread (https://github.com/slimtoolkit/slim/issues/178) that this could be a case of the underlying base OS not having support for fanotify i.e. Alpine. This is the case with Colima default as it uses Alpine base by default but one can switch to Ubuntu using the colima start -l flag. I've switched to ubuntu base on Colima and still seeing the same issue with my build below:

Here's the build container log:

time="2023-02-27T02:10:49Z" level=debug msg="channel.CommandServer.OnConnection.worker: 172.17.0.1:48770 -> 172.17.0.2:65501 - conn.Write wc=99 err=<nil>"
time="2023-02-27T02:10:49Z" level=debug msg="channel.CommandServer.OnConnection.worker: 172.17.0.1:48770 -> 172.17.0.2:65501 - replied with frame='[<|]{\"tid\":\"1677463850245300000.163f5f0f9a621d72\",\"type\":\"ft.response\",\"body\":{\"status\":\"ok\"}}[|>]\n'"
time="2023-02-27T02:10:49Z" level=debug msg="sensor: new command => &{RTASourcePT:true AppName:./start.sh AppArgs:[] AppEntrypoint:[] AppCmd:[] AppUser: AppStdoutToFile:false AppStderrToFile:false RunTargetAsUser:false ReportOnMainPidExit:false KeepPerms:true Perms:map[] Excludes:[] Preserves:map[] Includes:map[] IncludeBins:[] IncludeExes:[] IncludeShell:false IncludeCertAll:true IncludeCertBundles:false IncludeCertDirs:false IncludeCertPKAll:false IncludeCertPKDirs:false IncludeNew:true IncludeOSLibsNet:true IncludeAppNuxtDir:false IncludeAppNuxtBuildDir:false IncludeAppNuxtDistDir:false IncludeAppNuxtStaticDir:false IncludeAppNuxtNodeModulesDir:false IncludeAppNextDir:false IncludeAppNextBuildDir:false IncludeAppNextDistDir:false IncludeAppNextStaticDir:false IncludeAppNextNodeModulesDir:false IncludeNodePackages:[]}"
time="2023-02-27T02:10:49Z" level=debug msg="sensor.app.prepareEnv()"
time="2023-02-27T02:10:49Z" level=debug msg="sensor.app.prepareEnv - prep file artifacts root dir - '/opt/_slim/artifacts/files'"
time="2023-02-27T02:10:49Z" level=debug msg="sensor: getCurrentPaths() - skipping /dev file system objects..."
time="2023-02-27T02:10:49Z" level=debug msg="sensor: getCurrentPaths() - skipping /dev file system objects..."
time="2023-02-27T02:10:49Z" level=debug msg="sensor: getCurrentPaths() - skipping /dev file system objects..."
time="2023-02-27T02:10:51Z" level=debug msg="sensor: getCurrentPaths() - skipping /proc file system objects..."
time="2023-02-27T02:10:51Z" level=debug msg="sensor: getCurrentPaths() - skipping /proc file system objects..."
time="2023-02-27T02:10:51Z" level=debug msg="sensor: getCurrentPaths() - skipping /proc file system objects..."
time="2023-02-27T02:10:51Z" level=debug msg="sensor: getCurrentPaths() - skipping /sys file system objects..."
time="2023-02-27T02:10:51Z" level=debug msg="sensor: getCurrentPaths() - skipping /sys file system objects..."
time="2023-02-27T02:10:51Z" level=debug msg="sensor: getCurrentPaths() - skipping /sys file system objects..."
time="2023-02-27T02:10:51Z" level=debug msg="sensor: getCurrentPaths() - skipping /sys file system objects..."
time="2023-02-27T02:10:51Z" level=debug msg="sensor: getCurrentPaths() - skipping /sys file system objects..."
time="2023-02-27T02:10:51Z" level=debug msg="sensor: getCurrentPaths() - skipping /sys file system objects..."
time="2023-02-27T02:10:51Z" level=debug msg="sensor: getCurrentPaths() - skipping /sys file system objects..."
time="2023-02-27T02:10:51Z" level=debug msg="sensor: getCurrentPaths() - skipping /sys file system objects..."
time="2023-02-27T02:10:51Z" level=debug msg="sensor: getCurrentPaths() - skipping /sys file system objects..."
time="2023-02-27T02:10:51Z" level=debug msg="sensor: getCurrentPaths() - skipping /sys file system objects..."
time="2023-02-27T02:10:51Z" level=debug msg="sensor: getCurrentPaths() - skipping /sys file system objects..."
time="2023-02-27T02:10:53Z" level=info msg="sensor: creating monitors..."
time="2023-02-27T02:10:53Z" level=info msg="sensor: starting monitors..."
time="2023-02-27T02:10:53Z" level=info msg="fanmon: Start"
time="2023-02-27T02:10:53Z" level=error msg="sensor: composite monitor - FAN failed to start running" error="SensorError{Op:sensor.fanotify.Run/fanapi.Initialize,Kind:call.error,Wrapped:{Type=syscall.Errno,Info=function not implemented,Line:101,File:github.com/docker-slim/docker-slim/pkg/app/sensor/monitors/fanotify/monitor.go}}"
time="2023-02-27T02:10:53Z" level=error msg="sensor: failed to start composite monitor" error="SensorError{Op:sensor.fanotify.Run/fanapi.Initialize,Kind:call.error,Wrapped:{Type=syscall.Errno,Info=function not implemented,Line:101,File:github.com/docker-slim/docker-slim/pkg/app/sensor/monitors/fanotify/monitor.go}}"
time="2023-02-27T02:10:53Z" level=debug msg="ipc.Server.TryPublishEvt(&{Name:event.monitor.start.failed Data:[]})"
time="2023-02-27T02:10:53Z" level=debug msg="channel.Broadcast.Write: 172.17.0.1:35524 -> 172.17.0.2:65502 - conn.Write wc=130 err=<nil>"
time="2023-02-27T02:10:53Z" level=debug msg="ipc.Server.TryPublishEvt(&{Name:event.error Data:[run sensor without monitor failed: SensorError{Op:sensor.fanotify.Run/fanapi.Initialize,Kind:call.error,Wrapped:{Type=syscall.Errno,Info=function not implemented,Line:101,File:github.com/docker-slim/docker-slim/pkg/app/sensor/monitors/fanotify/monitor.go}}]})"
time="2023-02-27T02:10:53Z" level=debug msg="channel.Broadcast.Write: 172.17.0.1:35524 -> 172.17.0.2:65502 - conn.Write wc=371 err=<nil>"
time="2023-02-27T02:10:53Z" level=info msg="sensor: done!"
time="2023-02-27T02:10:53Z" level=debug msg="channel.Server.Start.loop.Accept - new connection... [time=1677463853005849206]"
time="2023-02-27T02:10:53Z" level=error msg="channel.Server.Start() - loop.Accept error = accept tcp [::]:65501: use of closed network connection"
time="2023-02-27T02:10:53Z" level=debug msg="channel.Server.Start.loop.Accept - new connection... [time=1677463853005949201]"
time="2023-02-27T02:10:53Z" level=error msg="channel.Server.Start() - loop.Accept error = accept tcp [::]:65502: use of closed network connection"

and here's the same log using the --show-clogs build command flag:

❯ slim --log-level info --log slim.log build --show-clogs nginx:latest
app='slim' message='Join the Gitter channel to ask questions or to share your feedback' info='https://gitter.im/docker-slim/community'
app='slim' message='Join the Discord server to ask questions or to share your feedback' info='https://discord.gg/9tDyxYS'
app='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 target.type='image' target='nginx:latest' continue.mode='probe' rt.as.user='true' keep.perms='true' tags=''
cmd=build state=image.inspection.start
cmd=build info=image id='sha256:3f8a00f137a0d2c8a2163a09901e28e2471999fde4efc2f9570b91f1c30acf94' size.bytes='141838619' size.human='142 MB'
cmd=build info=image.stack name='nginx:latest' id='sha256:3f8a00f137a0d2c8a2163a09901e28e2471999fde4efc2f9570b91f1c30acf94' index='0'
cmd=build info=image.exposed_ports list='80'
cmd=build state=image.inspection.done
cmd=build state=container.inspection.start
cmd=build info=container status='created' name='slimk_6948_20230227023254' id='3431e55fdb100fb8350e7ccff01a972f75fa19589df54d65b33deda319111912'
cmd=build info=container id='3431e55fdb100fb8350e7ccff01a972f75fa19589df54d65b33deda319111912' status='running' name='slimk_6948_20230227023254'
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.unexpected' data='&{Name:event.monitor.start.failed Data:<nil>}'
slim: container stdout:
slim: container stderr:
time="2023-02-27T02:32:54Z" level=info msg="sensor: ver=linux|Transformer|1.40.0|latest|latest"
time="2023-02-27T02:32:56Z" level=info msg="sensor: waiting for commands..."
time="2023-02-27T02:32:56Z" level=info msg="sensor: creating monitors..."
time="2023-02-27T02:32:56Z" level=info msg="sensor: starting monitors..."
time="2023-02-27T02:32:56Z" level=info msg="fanmon: Start"
time="2023-02-27T02:32:56Z" level=error msg="sensor: composite monitor - FAN failed to start running" error="SensorError{Op:sensor.fanotify.Run/fanapi.Initialize,Kind:call.error,Wrapped:{Type=syscall.Errno,Info=function not implemented,Line:101,File:github.com/docker-slim/docker-slim/pkg/app/sensor/monitors/fanotify/monitor.go}}"
time="2023-02-27T02:32:56Z" level=error msg="sensor: failed to start composite monitor" error="SensorError{Op:sensor.fanotify.Run/fanapi.Initialize,Kind:call.error,Wrapped:{Type=syscall.Errno,Info=function not implemented,Line:101,File:github.com/docker-slim/docker-slim/pkg/app/sensor/monitors/fanotify/monitor.go}}"
time="2023-02-27T02:32:56Z" level=info msg="sensor: done!"
time="2023-02-27T02:32:56Z" level=error msg="channel.Server.Start() - loop.Accept error = accept tcp [::]:65501: use of closed network connection"
time="2023-02-27T02:32:56Z" level=error msg="channel.Server.Start() - loop.Accept error = accept tcp [::]:65502: use of closed network connection"
slim: end of container logs =============
cmd=build info=report file='slim.report.json'

What's the use case for the fanotify in the build context? Appreciate any help how to get past this error....

kcq commented 12 months ago

fanotify is one of the monitors used to get the telemetry Slim needs. The failure could be related to QEMU colima/lima uses and/or potentially to M1 macs (at least, for some of the problems shared in this thread).