Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slim 1.40.9 not compatible with new release docker 25.0 #632

Closed
eli-yip opened this issue Jan 20, 2024 · 17 comments
Closed

slim 1.40.9 not compatible with new release docker 25.0 #632

eli-yip opened this issue Jan 20, 2024 · 17 comments

Comments

@eli-yip
Copy link

eli-yip commented Jan 20, 2024

Expected Behavior

slim optimize docker image


Actual Behavior

throw an error tell me my docker engine api version is too low, which is not the case at all.

time="2024-01-20T03:55:39Z" level=error msg="dockerutil.BuildEmptyImage: dockerapi.BuildImage() error = API error (400): client version 1.12 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version\n / output: "
time="2024-01-20T03:55:39Z" level=fatal msg="slim: failure" error="API error (400): client version 1.12 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version\n" stack="goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x5e\ngithub.com/slimtoolkit/slim/pkg/util/errutil.FailOn({0x2fb89e0, 0xc0005aa738})\n\tgithub.com/slimtoolkit/slim/pkg/util/errutil/errutil.go:32 +0x4b\ngithub.com/slimtoolkit/slim/pkg/app/master/inspectors/container.(*Inspector).RunContainer(0xc0001758c0)\n\tgithub.com/slimtoolkit/slim/pkg/app/master/inspectors/container/container_inspector.go:438 +0x774\ngithub.com/slimtoolkit/slim/pkg/app/master/command/build.OnCommand(_, _, {_, _}, _, {_, _}, {_, _}, {0x0, ...}, ...)\n\tgithub.com/slimtoolkit/slim/pkg/app/master/command/build/handler.go:1126 +0x45f2\ngithub.com/slimtoolkit/slim/pkg/app/master/command/build.glob..func1(0xc00046ad80)\n\tgithub.com/slimtoolkit/slim/pkg/app/master/command/build/cli.go:750 +0x5cd0\ngithub.com/urfave/cli/v2.(*Command).Run(0x3fe6620, 0xc00070e600)\n\tgithub.com/urfave/cli/v2@v2.3.0/command.go:163 +0x583\ngithub.com/urfave/cli/v2.(*App).RunContext(0xc0006229c0, {0x2fd6b78?, 0x41bbb40}, {0xc000052070, 0x7, 0x7})\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:313 +0xaa5\ngithub.com/urfave/cli/v2.(*App).Run(...)\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:224\ngithub.com/slimtoolkit/slim/pkg/app/master.Run()\n\tgithub.com/slimtoolkit/slim/pkg/app/master/app.go:15 +0x45\nmain.main()\n\tgithub.com/slimtoolkit/slim/cmd/slim/main.go:15 +0x187\n" version="linux/amd64|Transformer|1.40.9|latest|latest"

But when I downgrade my docker version to 24.0.7, it works fine again.

My system is ubuntu 22.04.

@kcq kcq added the triage label Jan 21, 2024
@kcq
Copy link
Member

kcq commented Jan 21, 2024

@eli-yip thank you for the report! investigating...

@kcq
Copy link
Member

kcq commented Jan 22, 2024

The issue appears to be limited in certain environments. Doesn't manifest itself everywhere. Still investigating...

@eli-yip
Copy link
Author

eli-yip commented Jan 24, 2024

The issue appears to be limited in certain environments. Doesn't manifest itself everywhere. Still investigating...

Now with slim 1.40.10 (latest stable version) and docker 25.0, I tried to slim build, but got a different error.

slim --debug build --tag test:1.0 --http-probe=false --pull --target alpine:3.19

Result:

time="2024-01-24T08:55:13Z" level=fatal msg="slim: failure" error="json: unsupported value: NaN" stack="goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x5e\ngithub.com/slimtoolkit/slim/pkg/util/errutil.FailOn({0x2316e20, 0xc000a8afc0})\n\tgithub.com/slimtoolkit/slim/pkg/util/errutil/errutil.go:32 +0x4b\ngithub.com/slimtoolkit/slim/pkg/report.(*Command).saveInfo(0xc000101c00, {0x1d678e0, 0xc000101c00})\n\tgithub.com/slimtoolkit/slim/pkg/report/command_report.go:543 +0x22a\ngithub.com/slimtoolkit/slim/pkg/report.(*BuildCommand).Save(...)\n\tgithub.com/slimtoolkit/slim/pkg/report/command_report.go:571\ngithub.com/slimtoolkit/slim/pkg/app/master/command/build.finishCommand(0xc0000b0980, {0x7fffa302d42b, 0x9}, {0x0, 0x0}, 0x0, {0x0, 0x0}, {0xc0009a6057, 0x40}, ...)\n\tgithub.com/slimtoolkit/slim/pkg/app/master/command/build/handler.go:1684 +0x1ac8\ngithub.com/slimtoolkit/slim/pkg/app/master/command/build.OnCommand(_, _, {_, _}, _, {_, _}, {_, _}, {0x0, ...}, ...)\n\tgithub.com/slimtoolkit/slim/pkg/app/master/command/build/handler.go:1241 +0x5365\ngithub.com/slimtoolkit/slim/pkg/app/master/command/build.glob..func1(0xc000804f40)\n\tgithub.com/slimtoolkit/slim/pkg/app/master/command/build/cli.go:754 +0x5cf2\ngithub.com/urfave/cli/v2.(*Command).Run(0x3391220, 0xc0004f8780)\n\tgithub.com/urfave/cli/v2@v2.3.0/command.go:163 +0x583\ngithub.com/urfave/cli/v2.(*App).RunContext(0xc000501860, {0x23348a8?, 0x3408b00}, {0xc000050100, 0x8, 0x8})\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:313 +0xaa5\ngithub.com/urfave/cli/v2.(*App).Run(...)\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:224\ngithub.com/slimtoolkit/slim/pkg/app/master.Run()\n\tgithub.com/slimtoolkit/slim/pkg/app/master/app.go:15 +0x45\nmain.main()\n\tgithub.com/slimtoolkit/slim/cmd/slim/main.go:15 +0x187\n" version="linux/amd64|Transformer|1.40.10|b04d388ded5cc50e89c532604b63cc2c0966f5cf|2024-01-18_04:11:02AM"

Whole output in my terminal:

slim --debug build --tag test:1.0 --http-probe=false --pull --target alpine:3.19
time="2024-01-24T09:00:10Z" level=debug msg="sysinfo => system.SystemInfo{Sysname:\"Linux\", Nodename:\"homelab\", Release:\"5.15.0-91-generic\", Version:\"#101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023\", Machine:\"x86_64\", Domainname:\"(none)\", OsBuild:\"\", Distro:system.DistroInfo{Name:\"Ubuntu\", Version:\"22.04\", DisplayName:\"Ubuntu 22.04.3 LTS\"}}"
time="2024-01-24T09:00:10Z" level=debug msg="param.error.app.options - no app params"
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'
time="2024-01-24T09:00:10Z" level=debug msg="customImageTag='test:1.0', additionalTags=[]string(nil)" app=slim cmd=build
time="2024-01-24T09:00:10Z" level=debug msg="dockerclient.GetUnixSocketAddr(): found => {\"address\":\"unix:///var/run/docker.sock\",\"file_path\":\"/var/run/docker.sock\",\"type\":\"file\",\"perms\":\"\",\"can_read\":true,\"can_write\":true}\n"
time="2024-01-24T09:00:10Z" level=debug msg="dockerclient.New: new Docker client (default) [6]"
time="2024-01-24T09:00:10Z" level=debug msg="dockerclient.New: configured DOCKER_HOST env var"
cmd=build state=started
cmd=build info=params target.type='image' target.image='alpine:3.19' continue.mode='enter' rt.as.user='true' keep.perms='true' tags='test:1.0' image-build-engine='internal'
time="2024-01-24T09:00:10Z" level=info msg="image=alpine:3.19 http-probe=false remove-file-artifacts=false image-overrides=map[] entrypoint=[] (false) cmd=[] (false) workdir='' env=[] expose=map[]" app=slim cmd=build
cmd=build info=app cmd='build' version='linux/amd64|Transformer|1.40.10|b04d388ded5cc50e89c532604b63cc2c0966f5cf|2024-01-18_04:11:02AM' container='false' dsimage='false' location='/home/linuxbrew/.linuxbrew/Cellar/docker-slim/1.40.9/bin'
cmd=build info=host cmd='build' osname='Ubuntu 22.04.3 LTS' osbuild='' version='#101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023' release='5.15.0-91-generic' sysname='Linux'
cmd=build info=docker kernel.version='5.15.0-91-generic' operating.system='Ubuntu 22.04.3 LTS' ostype='linux' server.version='25.0.0' architecture='x86_64' cmd='build' name='homelab'
cmd=build info=dclient cmd='build' api.version='1.44' mini.api.version='1.24' build.time='2024-01-18T17:09:49.000000000+00:00' git.commit='615dfdf'
cmd=build state=image.inspection.start
time="2024-01-24T09:00:10Z" level=info msg="inspecting 'fat' image metadata..." app=slim cmd=build
time="2024-01-24T09:00:10Z" level=debug msg="PrepareImageStateDirs(,sha256:f8c20f8bbcb684055b4fea470fdd169c86e87786940b3262335b12ec3adef418)"
time="2024-01-24T09:00:10Z" level=debug msg="PrepareImageStateDirs - removing existing state location: /home/linuxbrew/.linuxbrew/Cellar/docker-slim/1.40.9/bin/.slim-state/images/f8c20f8bbcb684055b4fea470fdd169c86e87786940b3262335b12ec3adef418/artifacts"
time="2024-01-24T09:00:10Z" level=debug msg="PrepareImageStateDirs - created new image state location: /home/linuxbrew/.linuxbrew/Cellar/docker-slim/1.40.9/bin/.slim-state/images/f8c20f8bbcb684055b4fea470fdd169c86e87786940b3262335b12ec3adef418/artifacts"
time="2024-01-24T09:00:10Z" level=debug msg="localVolumePath=/home/linuxbrew/.linuxbrew/Cellar/docker-slim/1.40.9/bin/.slim-state/images/f8c20f8bbcb684055b4fea470fdd169c86e87786940b3262335b12ec3adef418, artifactLocation=/home/linuxbrew/.linuxbrew/Cellar/docker-slim/1.40.9/bin/.slim-state/images/f8c20f8bbcb684055b4fea470fdd169c86e87786940b3262335b12ec3adef418/artifacts, statePath=/home/linuxbrew/.linuxbrew/Cellar/docker-slim/1.40.9/bin, stateKey=f8c20f8bbcb684055b4fea470fdd169c86e87786940b3262335b12ec3adef418" app=slim cmd=build
cmd=build info=image size.bytes='0' size.human='0 B' id='sha256:f8c20f8bbcb684055b4fea470fdd169c86e87786940b3262335b12ec3adef418'
time="2024-01-24T09:00:10Z" level=info msg="processing 'fat' image info..." app=slim cmd=build
time="2024-01-24T09:00:10Z" level=debug msg="IMAGE INSTRUCTIONS:"
time="2024-01-24T09:00:10Z" level=debug msg="FROM scratch"
time="2024-01-24T09:00:10Z" level=debug msg="# new image"
time="2024-01-24T09:00:10Z" level=debug msg="\n# instruction set group 1\n"
time="2024-01-24T09:00:10Z" level=debug msg="ADD file:1f4eb46669b5b6275af19eb7471a6899a61c276aa7d925b8ae99310b14b75b92 /"
time="2024-01-24T09:00:10Z" level=debug msg="CMD [\"/bin/sh\"]\n"
time="2024-01-24T09:00:10Z" level=debug msg="# end of image: alpine:3.19 (id:  tags: alpine:3.19)"
time="2024-01-24T09:00:10Z" level=debug
cmd=build info=image.stack index='0' name='alpine:3.19' id='sha256:f8c20f8bbcb684055b4fea470fdd169c86e87786940b3262335b12ec3adef418'
cmd=build state=image.inspection.done
cmd=build state=container.inspection.start
time="2024-01-24T09:00:10Z" level=debug msg="FatContainerCmd - [/bin/sh]" app=slim cmd=build component=container.inspector
time="2024-01-24T09:00:10Z" level=info msg="starting instrumented 'fat' container..." app=slim cmd=build
time="2024-01-24T09:00:10Z" level=debug msg="sensor.EnsureLocalBinary: sensor (/home/linuxbrew/.linuxbrew/Cellar/docker-slim/1.40.9/bin/slim-sensor) perms => 0755" app=slim cmd=build component=container.inspector
time="2024-01-24T09:00:10Z" level=debug msg="ensureSensorVolume: already have volume = slim-sensor.1.40.10" app=slim cmd=build component=container.inspector
time="2024-01-24T09:00:10Z" level=debug msg="RunContainer: default exposed ports => map[docker.Port]struct {}{\"65501/tcp\":struct {}{}, \"65502/tcp\":struct {}{}}" app=slim cmd=build component=container.inspector
time="2024-01-24T09:00:10Z" level=debug msg="RunContainer: HostConfig.PublishAllPorts => true" app=slim cmd=build component=container.inspector
cmd=build info=container status='created' name='slimk_279989_20240124090010' id='3922f7324241352ac9b33c4cc5ed1e1040cb1afdf949443402a632f902f04b4a'
time="2024-01-24T09:00:10Z" level=debug msg="container HostConfig.NetworkMode => default len(ports)=2" app=slim cmd=build component=container.inspector op=container.Inspector.RunContainer
time="2024-01-24T09:00:10Z" level=debug msg="container NetworkSettings.Ports => map[docker.Port][]docker.PortBinding{\"65501/tcp\":[]docker.PortBinding{docker.PortBinding{HostIP:\"0.0.0.0\", HostPort:\"32773\"}, docker.PortBinding{HostIP:\"::\", HostPort:\"32773\"}}, \"65502/tcp\":[]docker.PortBinding{docker.PortBinding{HostIP:\"0.0.0.0\", HostPort:\"32772\"}, docker.PortBinding{HostIP:\"::\", HostPort:\"32772\"}}}" app=slim cmd=build component=container.inspector op=container.Inspector.RunContainer
cmd=build info=container status='running' name='slimk_279989_20240124090010' id='3922f7324241352ac9b33c4cc5ed1e1040cb1afdf949443402a632f902f04b4a'
cmd=build info=container message='obtained IP address' ip='172.17.0.2'
time="2024-01-24T09:00:10Z" level=debug msg=target.container.ipc.connect app=slim cmd=build component=container.inspector container.network= in.container=false ipc.mode=proxy op=container.Inspector.initContainerChannels port.cmd=32773 port.evt=32772 target=127.0.0.1
time="2024-01-24T09:00:10Z" level=debug msg="ipc.NewClient(127.0.0.1,32773,32772)"
time="2024-01-24T09:00:10Z" level=debug msg="channel.NewClient: connect wait timeout - 1m0s"
time="2024-01-24T09:00:10Z" level=debug msg="channel.NewClient: net.DialTimeout(tcp,127.0.0.1:32773,15s) [time=1706086810952091979]"
time="2024-01-24T09:00:10Z" level=debug msg="channel.Client.Write: remote=127.0.0.1:32773 -> local=127.0.0.1:39148 - conn.Write wc=75 err=<nil> [time=1706086810952293762]"
time="2024-01-24T09:00:10Z" level=debug msg="channel.Client.Read() - (0xc000780180)reader.ReadString => err=<nil> raw=\"[<|]{\\\"tid\\\":\\\"1706086810952238304.38586fbedcb9f47e\\\",\\\"type\\\":\\\"ft.control\\\"}[|>]\\n\""
time="2024-01-24T09:00:10Z" level=debug msg="channel.Client.Read: got raw frame ='[<|]{\"tid\":\"1706086810952238304.38586fbedcb9f47e\",\"type\":\"ft.control\"}[|>]\n'"
time="2024-01-24T09:00:10Z" level=debug msg="channel.Client.Read: frame data => tid=1706086810952238304.38586fbedcb9f47e type=ft.control body=''"
time="2024-01-24T09:00:10Z" level=debug msg="verifyCommandChannel: client.Read() (tid=1706086810952238304.38586fbedcb9f47e type=ft.control) result.data=''"
time="2024-01-24T09:00:10Z" level=debug msg="channel.NewClient: connect wait timeout - 1m0s"
time="2024-01-24T09:00:10Z" level=debug msg="channel.NewClient: net.DialTimeout(tcp,127.0.0.1:32772,15s) [time=1706086810952890868]"
time="2024-01-24T09:00:10Z" level=debug msg="ipc.Client.SendCommand() cmd channel call data='{\"name\":\"cmd.monitor.start\",\"data\":{\"obfuscate_metadata\":false,\"rta_source_ptrace\":true,\"app_name\":\"/bin/sh\",\"app_stdout_to_file\":false,\"app_stderr_to_file\":false,\"report_on_main_pid_exit\":false,\"keep_perms\":true,\"exclude_varlock_files\":true,\"include_cert_all\":true,\"include_new\":true,\"include_oslibs_net\":true}}'\n"
time="2024-01-24T09:00:10Z" level=debug msg="channel.CommandClient.Call: calling c.Write()"
time="2024-01-24T09:00:10Z" level=debug msg="channel.Client.Write: remote=127.0.0.1:32773 -> local=127.0.0.1:39148 - conn.Write wc=395 err=<nil> [time=1706086810953224309]"
time="2024-01-24T09:00:10Z" level=debug msg="channel.CommandClient.Call: calling c.Read()"
time="2024-01-24T09:00:10Z" level=debug msg="channel.Client.Read() - (0xc000780180)reader.ReadString => err=<nil> raw=\"[<|]{\\\"tid\\\":\\\"1706086810953190015.3eaa57e5fc7b85d8\\\",\\\"type\\\":\\\"ft.response\\\",\\\"body\\\":{\\\"status\\\":\\\"ok\\\"}}[|>]\\n\""
time="2024-01-24T09:00:10Z" level=debug msg="channel.Client.Read: got raw frame ='[<|]{\"tid\":\"1706086810953190015.3eaa57e5fc7b85d8\",\"type\":\"ft.response\",\"body\":{\"status\":\"ok\"}}[|>]\n'"
time="2024-01-24T09:00:10Z" level=debug msg="channel.Client.Read: frame data => tid=1706086810953190015.3eaa57e5fc7b85d8 type=ft.response body='{\"status\":\"ok\"}'"
time="2024-01-24T09:00:10Z" level=debug msg="channel.CommandClient.Call: c.Read() (tid=1706086810953190015.3eaa57e5fc7b85d8 type=ft.response) result.data='{\"status\":\"ok\"}'"
time="2024-01-24T09:00:10Z" level=debug msg="ipc.Client.SendCommand() cmd channel call response='{\"status\":\"ok\"}'\n"
cmd=build info=cmd.startmonitor status='sent'
time="2024-01-24T09:00:10Z" level=debug msg="channel.Client.Read() - (0xc000780240)reader.ReadString => err=<nil> raw=\"[<|]{\\\"tid\\\":\\\"1706086810957870762.b9db1a3bbfdb2bd3\\\",\\\"type\\\":\\\"ft.event\\\",\\\"body\\\":{\\\"name\\\":\\\"event.monitor.start.done\\\"}}[|>]\\n\""
time="2024-01-24T09:00:10Z" level=debug msg="channel.Client.Read: got raw frame ='[<|]{\"tid\":\"1706086810957870762.b9db1a3bbfdb2bd3\",\"type\":\"ft.event\",\"body\":{\"name\":\"event.monitor.start.done\"}}[|>]\n'"
time="2024-01-24T09:00:10Z" level=debug msg="channel.Client.Read: frame data => tid=1706086810957870762.b9db1a3bbfdb2bd3 type=ft.event body='{\"name\":\"event.monitor.start.done\"}'"
time="2024-01-24T09:00:10Z" level=debug msg="ipc.Client.GetEvent(): channel.Recv() - done [tid=1706086810957870762.b9db1a3bbfdb2bd3 evt={\"name\":\"event.monitor.start.done\"}]\n"
cmd=build info=event.startmonitor.done status='received'
cmd=build info=container target.port.info='' message='YOU CAN USE THESE PORTS TO INTERACT WITH THE CONTAINER' name='slimk_279989_20240124090010' id='3922f7324241352ac9b33c4cc5ed1e1040cb1afdf949443402a632f902f04b4a' target.port.list=''
time="2024-01-24T09:00:10Z" level=info msg="watching container monitor..." app=slim cmd=build
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'
time="2024-01-24T09:00:11Z" level=debug msg="version.Check: http status = 200 OK" app=slim

cmd=build state=container.inspection.finishing
time="2024-01-24T09:00:14Z" level=debug msg="[SIGMON] Docker event monitor stopped" app=slim cmd=build component=container.inspector op=container.Inspector.RunContainer
time="2024-01-24T09:00:14Z" level=debug msg="Docker event monitor stopped" app=slim cmd=build component=container.inspector op=container.Inspector.RunContainer
time="2024-01-24T09:00:14Z" level=debug msg="ipc.Client.SendCommand() cmd channel call data='{\"name\":\"cmd.monitor.stop\"}'\n"
time="2024-01-24T09:00:14Z" level=debug msg="channel.CommandClient.Call: calling c.Write()"
time="2024-01-24T09:00:14Z" level=debug msg="channel.Client.Write: remote=127.0.0.1:32773 -> local=127.0.0.1:39148 - conn.Write wc=110 err=<nil> [time=1706086814883005561]"
time="2024-01-24T09:00:14Z" level=debug msg="channel.CommandClient.Call: calling c.Read()"
time="2024-01-24T09:00:14Z" level=debug msg="channel.Client.Read() - (0xc000780180)reader.ReadString => err=<nil> raw=\"[<|]{\\\"tid\\\":\\\"1706086814882876697.d1884cedba343891\\\",\\\"type\\\":\\\"ft.response\\\",\\\"body\\\":{\\\"status\\\":\\\"ok\\\"}}[|>]\\n\""
time="2024-01-24T09:00:14Z" level=debug msg="channel.Client.Read: got raw frame ='[<|]{\"tid\":\"1706086814882876697.d1884cedba343891\",\"type\":\"ft.response\",\"body\":{\"status\":\"ok\"}}[|>]\n'"
time="2024-01-24T09:00:14Z" level=debug msg="channel.Client.Read: frame data => tid=1706086814882876697.d1884cedba343891 type=ft.response body='{\"status\":\"ok\"}'"
time="2024-01-24T09:00:14Z" level=debug msg="channel.CommandClient.Call: c.Read() (tid=1706086814882876697.d1884cedba343891 type=ft.response) result.data='{\"status\":\"ok\"}'"
time="2024-01-24T09:00:14Z" level=debug msg="ipc.Client.SendCommand() cmd channel call response='{\"status\":\"ok\"}'\n"
time="2024-01-24T09:00:14Z" level=debug msg="'stop' monitor response => '&{ok}'" app=slim cmd=build component=container.inspector
time="2024-01-24T09:00:14Z" level=info msg="waiting for the container to finish its work..." app=slim cmd=build component=container.inspector
time="2024-01-24T09:00:15Z" level=debug msg="channel.Client.Read() - (0xc000780240)reader.ReadString => err=<nil> raw=\"[<|]{\\\"tid\\\":\\\"1706086815144667321.f345d0dafdc11a7a\\\",\\\"type\\\":\\\"ft.event\\\",\\\"body\\\":{\\\"name\\\":\\\"event.monitor.stop.done\\\"}}[|>]\\n\""
time="2024-01-24T09:00:15Z" level=debug msg="channel.Client.Read: got raw frame ='[<|]{\"tid\":\"1706086815144667321.f345d0dafdc11a7a\",\"type\":\"ft.event\",\"body\":{\"name\":\"event.monitor.stop.done\"}}[|>]\n'"
time="2024-01-24T09:00:15Z" level=debug msg="channel.Client.Read: frame data => tid=1706086815144667321.f345d0dafdc11a7a type=ft.event body='{\"name\":\"event.monitor.stop.done\"}'"
time="2024-01-24T09:00:15Z" level=debug msg="ipc.Client.GetEvent(): channel.Recv() - done [tid=1706086815144667321.f345d0dafdc11a7a evt={\"name\":\"event.monitor.stop.done\"}]\n"
time="2024-01-24T09:00:15Z" level=debug msg="sensor event => '&{event.monitor.stop.done <nil>}'" app=slim cmd=build component=container.inspector
time="2024-01-24T09:00:15Z" level=debug msg="sensor event => '&{event.monitor.stop.done <nil>}'" app=slim cmd=build component=container.inspector
time="2024-01-24T09:00:15Z" level=debug msg="ipc.Client.SendCommand() cmd channel call data='{\"name\":\"cmd.sensor.shutdown\"}'\n"
time="2024-01-24T09:00:15Z" level=debug msg="channel.CommandClient.Call: calling c.Write()"
time="2024-01-24T09:00:15Z" level=debug msg="channel.Client.Write: remote=127.0.0.1:32773 -> local=127.0.0.1:39148 - conn.Write wc=113 err=<nil> [time=1706086815146286403]"
time="2024-01-24T09:00:15Z" level=debug msg="channel.CommandClient.Call: calling c.Read()"
time="2024-01-24T09:00:15Z" level=debug msg="channel.Client.Read() - (0xc000780180)reader.ReadString => err=<nil> raw=\"[<|]{\\\"tid\\\":\\\"1706086815146220609.c49850a670211d8d\\\",\\\"type\\\":\\\"ft.response\\\",\\\"body\\\":{\\\"status\\\":\\\"ok\\\"}}[|>]\\n\""
time="2024-01-24T09:00:15Z" level=debug msg="channel.Client.Read: got raw frame ='[<|]{\"tid\":\"1706086815146220609.c49850a670211d8d\",\"type\":\"ft.response\",\"body\":{\"status\":\"ok\"}}[|>]\n'"
time="2024-01-24T09:00:15Z" level=debug msg="channel.Client.Read: frame data => tid=1706086815146220609.c49850a670211d8d type=ft.response body='{\"status\":\"ok\"}'"
time="2024-01-24T09:00:15Z" level=debug msg="channel.CommandClient.Call: c.Read() (tid=1706086815146220609.c49850a670211d8d type=ft.response) result.data='{\"status\":\"ok\"}'"
time="2024-01-24T09:00:15Z" level=debug msg="ipc.Client.SendCommand() cmd channel call response='{\"status\":\"ok\"}'\n"
time="2024-01-24T09:00:15Z" level=debug msg="'shutdown' sensor response => '&{ok}'" app=slim cmd=build component=container.inspector
time="2024-01-24T09:00:15Z" level=info msg="shutting down 'fat' container..." app=slim cmd=build
time="2024-01-24T09:00:15Z" level=debug msg="dockerutil.PrepareContainerDataArchive: ignoring tar object: files/"
time="2024-01-24T09:00:15Z" level=info msg="can't stop the slim container (container is not running)..." app=slim cmd=build component=container.inspector op=container.Inspector.ShutdownContainer
cmd=build state=container.inspection.artifact.processing
time="2024-01-24T09:00:15Z" level=info msg="processing instrumented 'fat' container info..." app=slim cmd=build
time="2024-01-24T09:00:15Z" level=info msg="generating AppArmor profile..." app=slim cmd=build component=container.inspector
time="2024-01-24T09:00:15Z" level=debug msg="seccomp.GenProfile: saving seccomp profile to /home/linuxbrew/.linuxbrew/Cellar/docker-slim/1.40.9/bin/.slim-state/images/f8c20f8bbcb684055b4fea470fdd169c86e87786940b3262335b12ec3adef418/artifacts/alpine-seccomp.json"
cmd=build state=container.inspection.done
time="2024-01-24T09:00:15Z" level=debug msg="image build engine - internal" app=slim cmd=build
cmd=build state=building message="building optimized image" engine=internal
time="2024-01-24T09:00:15Z" level=debug msg="NewImageBuilder: Using new image instructions => &{Entrypoint:[] ClearEntrypoint:false Cmd:[] ClearCmd:false Workdir: Env:[] Volumes:map[] ExposedPorts:map[] Labels:map[] RemoveEnvs:map[] RemoveVolumes:map[] RemoveExposedPorts:map[] RemoveLabels:map[]}"
time="2024-01-24T09:00:15Z" level=debug msg="DefaultSimpleBuilder.Build: config image"
time="2024-01-24T09:00:15Z" level=debug msg="DefaultSimpleBuilder.Build: [0] create image layer (type=lst.tar source=/home/linuxbrew/.linuxbrew/Cellar/docker-slim/1.40.9/bin/.slim-state/images/f8c20f8bbcb684055b4fea470fdd169c86e87786940b3262335b12ec3adef418/artifacts/files.tar)"
time="2024-01-24T09:00:15Z" level=debug msg="DefaultSimpleBuilder.Build: adding layers to image"
time="2024-01-24T09:00:15Z" level=debug msg="DefaultSimpleBuilder.Build: saving image to Docker"
time="2024-01-24T09:00:15Z" level=debug msg="DefaultSimpleBuilder.Build: pushed image to daemon - {\"status\":\"Loading layer\",\"progressDetail\":{\"current\":32768,\"total\":1129763},\"progress\":\"[=\\u003e                                                 ]  32.77kB/1.13MB\",\"id\":\"8dcd4794c8b8\"}\r\n{\"status\":\"Loading layer\",\"progressDetail\":{\"current\":1129763,\"total\":1129763},\"progress\":\"[==================================================\\u003e]   1.13MB/1.13MB\",\"id\":\"8dcd4794c8b8\"}\r\n{\"status\":\"Loading layer\",\"progressDetail\":{\"current\":1129763,\"total\":1129763},\"progress\":\"[==================================================\\u003e]   1.13MB/1.13MB\",\"id\":\"8dcd4794c8b8\"}\r\n{\"stream\":\"The image test:1.0 already exists, renaming the old one with ID sha256:fbbe4757b8552ba1f8124be952d6fb9bb0ecf019f57b838cf3b5bada642efb13 to empty string\\n\"}\r\n{\"stream\":\"Loaded image: test:1.0\\n\"}\r\n"
cmd=build state=completed
cmd=build info=results status='MINIFIED' by='NaNX' size.original='0 B' size.optimized='0 B'
cmd=build info=results image-build-engine='internal' image.name='test:1.0' image.size='0 B' has.data='true'
cmd=build info=results artifacts.location='/home/linuxbrew/.linuxbrew/Cellar/docker-slim/1.40.9/bin/.slim-state/images/f8c20f8bbcb684055b4fea470fdd169c86e87786940b3262335b12ec3adef418/artifacts'
cmd=build info=results artifacts.report='creport.json'
cmd=build info=results artifacts.dockerfile.reversed='Dockerfile.reversed'
cmd=build info=results artifacts.seccomp='alpine-seccomp.json'
cmd=build info=results artifacts.apparmor='alpine-apparmor-profile'
cmd=build state=done
cmd=build info=commands message='use the xray command to learn more about the optimize image'
time="2024-01-24T09:00:15Z" level=fatal msg="slim: failure" error="json: unsupported value: NaN" stack="goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x5e\ngithub.com/slimtoolkit/slim/pkg/util/errutil.FailOn({0x2316e20, 0xc000341d70})\n\tgithub.com/slimtoolkit/slim/pkg/util/errutil/errutil.go:32 +0x4b\ngithub.com/slimtoolkit/slim/pkg/report.(*Command).saveInfo(0xc000101400, {0x1d678e0, 0xc000101400})\n\tgithub.com/slimtoolkit/slim/pkg/report/command_report.go:543 +0x22a\ngithub.com/slimtoolkit/slim/pkg/report.(*BuildCommand).Save(...)\n\tgithub.com/slimtoolkit/slim/pkg/report/command_report.go:571\ngithub.com/slimtoolkit/slim/pkg/app/master/command/build.finishCommand(0xc0006aa6a0, {0x7fff8678342c, 0x8}, {0x0, 0x0}, 0x0, {0x0, 0x0}, {0xc0000f9687, 0x40}, ...)\n\tgithub.com/slimtoolkit/slim/pkg/app/master/command/build/handler.go:1684 +0x1ac8\ngithub.com/slimtoolkit/slim/pkg/app/master/command/build.OnCommand(_, _, {_, _}, _, {_, _}, {_, _}, {0x0, ...}, ...)\n\tgithub.com/slimtoolkit/slim/pkg/app/master/command/build/handler.go:1241 +0x5365\ngithub.com/slimtoolkit/slim/pkg/app/master/command/build.glob..func1(0xc000428dc0)\n\tgithub.com/slimtoolkit/slim/pkg/app/master/command/build/cli.go:754 +0x5cf2\ngithub.com/urfave/cli/v2.(*Command).Run(0x3391220, 0xc0005a0600)\n\tgithub.com/urfave/cli/v2@v2.3.0/command.go:163 +0x583\ngithub.com/urfave/cli/v2.(*App).RunContext(0xc00024eea0, {0x23348a8?, 0x3408b00}, {0xc000050120, 0x9, 0x9})\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:313 +0xaa5\ngithub.com/urfave/cli/v2.(*App).Run(...)\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:224\ngithub.com/slimtoolkit/slim/pkg/app/master.Run()\n\tgithub.com/slimtoolkit/slim/pkg/app/master/app.go:15 +0x45\nmain.main()\n\tgithub.com/slimtoolkit/slim/cmd/slim/main.go:15 +0x187\n" version="linux/amd64|Transformer|1.40.10|b04d388ded5cc50e89c532604b63cc2c0966f5cf|2024-01-18_04:11:02AM"

slim.report.json:

{
  "version": "1.1",
  "engine": "linux/amd64|Transformer|1.40.10|b04d388ded5cc50e89c532604b63cc2c0966f5cf|2024-01-18_04:11:02AM",
  "containerized": false,
  "host_distro": {
    "name": "Ubuntu",
    "version": "22.04",
    "display_name": "Ubuntu 22.04.3 LTS"
  },
  "type": "build",
  "state": "error",
  "target_reference": "alpine:3.19",
  "system": {
    "type": "",
    "release": "",
    "distro": {
      "name": "",
      "version": "",
      "display_name": ""
    }
  },
  "source_image": {
    "identity": {
      "id": ""
    },
    "size": 0,
    "size_human": "",
    "create_time": "",
    "docker_version": "",
    "architecture": "",
    "container_entry": {
      "exe_path": ""
    }
  },
  "minified_image_size": 0,
  "minified_image_size_human": "",
  "minified_image": "",
  "minified_image_has_data": false,
  "minified_by": 0,
  "artifact_location": "",
  "container_report_name": "",
  "seccomp_profile_name": "",
  "apparmor_profile_name": "",
  "image_stack": null,
  "image_created": false,
  "image_build_engine": ""
}

My docker version:

Client: Docker Engine - Community
 Version:           25.0.0
 API version:       1.44
 Go version:        go1.21.6
 Git commit:        e758fe5
 Built:             Thu Jan 18 17:09:49 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          25.0.0
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.6
  Git commit:       615dfdf
  Built:            Thu Jan 18 17:09:49 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.27
  GitCommit:        a1496014c916f9e62104b33d1bb5bd03b0858e59
 runc:
  Version:          1.1.11
  GitCommit:        v1.1.11-0-g4bccb38
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

@kcq
Copy link
Member

kcq commented Jan 25, 2024

thank you for sharing the logs @eli-yip ... investigating

@kcq
Copy link
Member

kcq commented Jan 25, 2024

@eli-yip note that you are trying to minify a base image, alpine:3.19 and without specifying a lot of extra flags you are likely not going to get what you expect. Base images are like "stem cells", you don't know what they will become and because of that you don't know what needs to be there and what doesn't. When you create an application container image that provides the necessary context about the container image function. Without the application in the container image you have to explicitly indicate what you need and what you don't need in the base image. It is possible to do with the --include-*, --exclude-* and other build command flags (like --exec).

@kcq
Copy link
Member

kcq commented Jan 26, 2024

finally managed to reproduce it and there's a fix for it (will be available in the next release)

@eli-yip
Copy link
Author

eli-yip commented Jan 26, 2024

finally managed to reproduce it and there's a fix for it (will be available in the next release)

@kcq thank you!!!

@eli-yip
Copy link
Author

eli-yip commented Jan 26, 2024

@eli-yip note that you are trying to minify a base image, alpine:3.19 and without specifying a lot of extra flags you are likely not going to get what you expect. Base images are like "stem cells", you don't know what they will become and because of that you don't know what needs to be there and what doesn't. When you create an application container image that provides the necessary context about the container image function. Without the application in the container image you have to explicitly indicate what you need and what you don't need in the base image. It is possible to do with the --include-*, --exclude-* and other build command flags (like --exec).

Thank you for the reminder. I am using the alpine image here to confirm whether the issue is due to compatibility between Docker and Slim, rather than from my own image build.

To ensure that I've understood you correctly, let me clarify: Even for testing purposes, I should not use a base image, as this would cause errors with Slim?

@kcq
Copy link
Member

kcq commented Jan 27, 2024

@eli-yip it's ok to use a vanilla base image if it's for testing purposes. Just wanted to make sure you are aware of what you'll get there. I also recommend picking a simple shell command with that vanilla base image, so the minified version would have that command and you can see that the minified image works (for that shell command you picked).

Example: slim build --http-probe=false --entrypoint='ls -lh' alpine

Then you should be able to use the minified image like this: docker run -it --rm alpine.slim ls -lh

@eli-yip
Copy link
Author

eli-yip commented Jan 27, 2024

@eli-yip it's ok to use a vanilla base image if it's for testing purposes. Just wanted to make sure you are aware of what you'll get there. I also recommend picking a simple shell command with that vanilla base image, so the minified version would have that command and you can see that the minified image works (for that shell command you picked).

Example: slim build --http-probe=false --entrypoint='ls -lh' alpine

Then you should be able to use the minified image like this: docker run -it --rm alpine.slim ls -lh

Thank you

@kcq
Copy link
Member

kcq commented Jan 27, 2024

Docker Engine v25.x broke other things too... waiting for the upstream dependency maintainers to have a fix

@kcq
Copy link
Member

kcq commented Feb 1, 2024

getting close... will update in a couple of days

@kcq
Copy link
Member

kcq commented Feb 2, 2024

new release, should support Docker Engine 25.x: https://github.com/slimtoolkit/slim/releases/tag/1.40.11

@kcq kcq added validating fix and removed triage labels Feb 2, 2024
@eli-yip
Copy link
Author

eli-yip commented Feb 2, 2024

new release, should support Docker Engine 25.x: 1.40.11 (release)

Works fine, thank you so much.

@eli-yip eli-yip closed this as completed Feb 2, 2024
@paulcalabro
Copy link
Contributor

paulcalabro commented Apr 20, 2024

@kcq

I'm actually still seeing this issue on OSX:

slim --version
slim version darwin/arm64|Transformer|1.40.11|latest|latest
docker --version
Docker version 25.0.3, build 4debf41
slim build --http-probe=false --entrypoint='ls -lh' alpine
...
 error="json: unsupported value: NaN"
...

@paulcalabro
Copy link
Contributor

paulcalabro commented Apr 20, 2024

Update:

Downgrading from API version 1.44 to 1.43 worked!

export DOCKER_API_VERSION='1.43'

@kcq
Copy link
Member

kcq commented Apr 20, 2024

@paulcalabro With that release you might need to adjust the docker API explicitly, but the latest version shouldn't require it. I couldn't repro the failure with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants