Open kksudo opened 1 year ago
This is a strange failure... appears to happen when the app tries to create an empty image. Can't repro the failure with my M1 (will try to update Docker Desktop).
Also wanted to double check... The archlinux:latest
image you are trying to work with is an amd
image (not an arm
image), right? At least, for me I couldn't get/pull the arm
version on my machine. If it's the case you'll need to use the --image-build-engine
flag and you'll need to set it to internal
. The default build engine uses the Docker API, which will only build images with the platform/architecture that matches your machine architecture (at least, it's the case with the Docker version I have installed).
The archlinux:latest image you are trying to work with is an amd image
Before I use it, I export amd64 export DOCKER_DEFAULT_PLATFORM=linux/amd64
. The main issue, It's happens with any image, not only this one.
With remote docker engine (when I try to use docker context on my remote server) I get exactly the same error.
image-build-engine
- no effect
Thanks for the extra context! The --image-build-engine
is relevant for the output image and the failure you've observed happens way before that when slim
is trying to create a volume for the sensor where it Docker fails to create the empty container image needed to create the volume. Looks like you are using the latest version of Docker Desktop and there's a good chance the failure is related to their latest enhancements to their default build engine. Good news it's easy to fix :-) Will make it work as-is in the next day or so and then will replace that logic not to use Docker at all.
Couldn't repro the empty image create failure with the latest. Can you try the latest release to see if you still getting the same problem there: https://github.com/slimtoolkit/slim/releases/tag/1.40.3
I'm following (on mac M1) by how-to guide from the main README page and getn an error with the base example:
And get an error like:
Expected Behavior
Actual Behavior
Full slim output
An output of the cmd `slim --debug build --target archlinux:latest --tag archlinux:curl --http-probe=false --exec "curl checkip.amazonaws.com"````shell slim --debug build --target archlinux:latest --tag archlinux:curl --http-probe=false --exec "curl checkip.amazonaws.com" time="2023-06-16T15:02:03+03:00" level=debug msg="sysinfo => system.SystemInfo{Sysname:\"darwin\", Nodename:\"KK-SUDO-MacBook-Pro.local\", Release:\"22.5.0\", Version:\" Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000\", Machine:\"arm64\", Domainname:\"\", OsBuild:\"22F66\", Distro:system.DistroInfo{Name:\"\", Version:\"\", DisplayName:\"other\"}}" 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/slimtoolkit/slim/discussions' time="2023-06-16T15:02:03+03:00" 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='updating continue-after mode to exec' time="2023-06-16T15:02:03+03:00" level=debug msg="customImageTag='archlinux:curl', additionalTags=[]string(nil)" app=slim command=build time="2023-06-16T15:02:03+03:00" level=debug msg="docker-slim: new Docker client (default) [6]" time="2023-06-16T15:02:03+03:00" level=debug msg="docker-slim: configured DOCKER_HOST env var" cmd=build state=started cmd=build info=params rt.as.user='true' keep.perms='true' tags='archlinux:curl' target.type='image' target='archlinux:latest' continue.mode='exec' time="2023-06-16T15:02:03+03:00" level=info msg="image=archlinux:latest http-probe=false remove-file-artifacts=false image-overrides=map[] entrypoint=[] (false) cmd=[] (false) workdir='' env=[] expose=map[]" app=slim command=build cmd=build info=app container='false' dsimage='false' location='/usr/local/bin' cmd='build' version='darwin|Transformer|1.40.2|762eea87bafc4b04fe6b0642a62534a148acdaca|2023-05-20_06:13:34AM' cmd=build info=host release='22.5.0' sysname='darwin' cmd='build' osname='other' osbuild='22F66' version=' Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000' cmd=build info=docker operating.system='Docker Desktop' ostype='linux' server.version='24.0.2-38-g8e70a1b23e' architecture='aarch64' cmd='build' name='docker-desktop' kernel.version='5.15.49-linuxkit-pr' cmd=build info=dclient cmd='build' api.version='1.43' mini.api.version='1.12' build.time='2023-06-02T15:58:50.000000000+00:00' git.commit='8e70a1b23e965d86ec8c2feb77605196ae124630' cmd=build state=image.inspection.start time="2023-06-16T15:02:03+03:00" level=info msg="inspecting 'fat' image metadata..." app=slim command=build time="2023-06-16T15:02:04+03:00" level=debug msg="PrepareImageStateDirs(,sha256:28cafcbd4df875971df45047bbbe80882e0cd7a8bfa02ff6bb4f702e0a3f87a6)" time="2023-06-16T15:02:04+03:00" level=debug msg="PrepareImageStateDirs - statePrefix=/usr/local/bin appDir=/usr/local/bin badPath=/usr/local/bin" time="2023-06-16T15:02:04+03:00" level=debug msg="PrepareImageStateDirs - overriding state path to /tmp/slim-state" time="2023-06-16T15:02:04+03:00" level=debug msg="PrepareImageStateDirs - statePrefix=/tmp/slim-state appDir=/usr/local/bin badPath=/usr/local/bin" time="2023-06-16T15:02:04+03:00" level=debug msg="PrepareImageStateDirs - copying sensor to state path (to /tmp/slim-state)" time="2023-06-16T15:02:04+03:00" level=debug msg="CopyRegularFile(false,/usr/local/bin/slim-sensor,/tmp/slim-state/slim-sensor,true)" time="2023-06-16T15:02:04+03:00" level=debug msg="PrepareImageStateDirs - removing existing state location: /tmp/slim-state/.slim-state/images/28cafcbd4df875971df45047bbbe80882e0cd7a8bfa02ff6bb4f702e0a3f87a6/artifacts" time="2023-06-16T15:02:04+03:00" level=debug msg="PrepareImageStateDirs - created new image state location: /tmp/slim-state/.slim-state/images/28cafcbd4df875971df45047bbbe80882e0cd7a8bfa02ff6bb4f702e0a3f87a6/artifacts" time="2023-06-16T15:02:04+03:00" level=debug msg="localVolumePath=/tmp/slim-state/.slim-state/images/28cafcbd4df875971df45047bbbe80882e0cd7a8bfa02ff6bb4f702e0a3f87a6, artifactLocation=/tmp/slim-state/.slim-state/images/28cafcbd4df875971df45047bbbe80882e0cd7a8bfa02ff6bb4f702e0a3f87a6/artifacts, statePath=/tmp/slim-state, stateKey=28cafcbd4df875971df45047bbbe80882e0cd7a8bfa02ff6bb4f702e0a3f87a6" app=slim command=build cmd=build info=image id='sha256:28cafcbd4df875971df45047bbbe80882e0cd7a8bfa02ff6bb4f702e0a3f87a6' size.bytes='146088413' size.human='146 MB' time="2023-06-16T15:02:04+03:00" level=info msg="processing 'fat' image info..." app=slim command=build time="2023-06-16T15:02:04+03:00" level=debug msg="IMAGE INSTRUCTIONS:" time="2023-06-16T15:02:04+03:00" level=debug msg="FROM scratch" time="2023-06-16T15:02:04+03:00" level=debug msg="# new image" time="2023-06-16T15:02:04+03:00" level=debug msg="\n# instruction set group 1\n" time="2023-06-16T15:02:04+03:00" level=debug msg="LABEL org.opencontainers.image.title=Arch Linux base Image" time="2023-06-16T15:02:04+03:00" level=debug msg="LABEL org.opencontainers.image.description=Official containerd image of Arch Linux, a simple, lightweight Linux distribution aimed for flexibility." time="2023-06-16T15:02:04+03:00" level=debug msg="LABEL org.opencontainers.image.authors=Santiago Torres-Arias (@SantiagoTorres), Christian Rebischke (@shibumi), Justin Kromlinger (@hashworks)"
time="2023-06-16T15:02:04+03:00" level=debug msg="LABEL org.opencontainers.image.url=https://gitlab.archlinux.org/archlinux/archlinux-docker/-/blob/master/README.md"
time="2023-06-16T15:02:04+03:00" level=debug msg="LABEL org.opencontainers.image.documentation=https://wiki.archlinux.org/title/Docker#Arch_Linux"
time="2023-06-16T15:02:04+03:00" level=debug msg="LABEL org.opencontainers.image.source=https://gitlab.archlinux.org/archlinux/archlinux-docker"
time="2023-06-16T15:02:04+03:00" level=debug msg="LABEL org.opencontainers.image.licenses=GPL-3.0-or-later"
time="2023-06-16T15:02:04+03:00" level=debug msg="LABEL org.opencontainers.image.version=20230611.0.157136"
time="2023-06-16T15:02:04+03:00" level=debug msg="LABEL org.opencontainers.image.revision=a395f71b6337b7612e5749a62698d598869059f0"
time="2023-06-16T15:02:04+03:00" level=debug msg="LABEL org.opencontainers.image.created=2023-06-11T00:06:39+00:00"
time="2023-06-16T15:02:04+03:00" level=debug msg="COPY dir:5bcbc6d753462b5256bd3e682323362d50da99be384069b33450827f76bbb1bb /"
time="2023-06-16T15:02:04+03:00" level=debug msg="RUN ldconfig && \\\n\tsed -i '/BUILD_ID/a VERSION_ID=20230611.0.157136' /etc/os-release"
time="2023-06-16T15:02:04+03:00" level=debug msg="ENV LANG=C.UTF-8"
time="2023-06-16T15:02:04+03:00" level=debug msg="CMD [\"/usr/bin/bash\"]\n"
time="2023-06-16T15:02:04+03:00" level=debug msg="# end of image: archlinux:latest (id: tags: archlinux:latest)"
time="2023-06-16T15:02:04+03:00" level=debug
cmd=build info=image.stack index='0' name='archlinux:latest' id='sha256:28cafcbd4df875971df45047bbbe80882e0cd7a8bfa02ff6bb4f702e0a3f87a6'
cmd=build state=image.inspection.done
cmd=build state=container.inspection.start
time="2023-06-16T15:02:04+03:00" level=debug msg="FatContainerCmd - [/usr/bin/bash]" app=slim command=build component=container.inspector
time="2023-06-16T15:02:04+03:00" level=info msg="starting instrumented 'fat' container..." app=slim command=build
time="2023-06-16T15:02:04+03:00" level=debug msg="sensor.EnsureLocalBinary: sensor (/tmp/slim-state/slim-sensor) perms => 0777" app=slim command=build component=container.inspector
time="2023-06-16T15:02:04+03:00" level=debug msg="dockerutil.HasVolume: volume not found - slim-sensor.1.40.2"
time="2023-06-16T15:02:04+03:00" level=debug msg="ensureSensorVolume: no volume yet = slim-sensor.1.40.2" app=slim command=build component=container.inspector
time="2023-06-16T15:02:04+03:00" level=error msg="dockerutil.BuildEmptyImage: dockerapi.BuildImage() error = invalid reference format"
time="2023-06-16T15:02:04+03:00" level=debug msg="ensureSensorVolume: dockerutil.BuildEmptyImage() - error = invalid reference format" app=slim command=build component=container.inspector
time="2023-06-16T15:02:04+03:00" level=fatal msg="slim: failure" error="invalid reference format" stack="goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x64\ngithub.com/docker-slim/docker-slim/pkg/util/errutil.FailOn({0x104270c80, 0x1400000c948})\n\tgithub.com/docker-slim/docker-slim/pkg/util/errutil/errutil.go:32 +0x38\ngithub.com/docker-slim/docker-slim/pkg/app/master/inspectors/container.(*Inspector).RunContainer(0x14000452dc0)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/inspectors/container/container_inspector.go:430 +0x5fc\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.OnCommand(_, _, {_, _}, _, {_, _}, {_, _}, {_, ...}, ...)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/handler.go:1117 +0x3a00\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.glob..func1(0x140007f6080)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/cli.go:743 +0x4854\ngithub.com/urfave/cli/v2.(*Command).Run(0x1050499c0, 0x1400019dac0)\n\tgithub.com/urfave/cli/v2@v2.3.0/command.go:163 +0x4fc\ngithub.com/urfave/cli/v2.(*App).RunContext(0x14000583860, {0x104289f50?, 0x1400019e008}, {0x140001a6000, 0xa, 0xa})\n\tgithub.com/urfave/cli/v2@v2.3.0/app.go:313 +0x860\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 +0x4c\nmain.main()\n\tgithub.com/docker-slim/docker-slim/cmd/slim/main.go:15 +0x1c4\n" version="darwin|Transformer|1.40.2|762eea87bafc4b04fe6b0642a62534a148acdaca|2023-05-20_06:13:34AM"
```
Steps to Reproduce the Problem
slim --debug build --target archlinux:latest --tag archlinux:curl --http-probe=false --exec "curl checkip.amazonaws.com"
Specifications
Docker version
#### Local docker context docker version Client: Cloud integration: v1.0.33 Version: 24.0.2 API version: 1.43 Go version: go1.20.4 Git commit: cb74dfc Built: Thu May 25 21:51:16 2023 OS/Arch: darwin/arm64 Context: desktop-linux Server: Docker Desktop 4.20.1 (110738) Engine: Version: 24.0.2-38-g8e70a1b23e API version: 1.43 (minimum version 1.12) Go version: go1.20.4 Git commit: 8e70a1b23e965d86ec8c2feb77605196ae124630 Built: Fri Jun 2 15:58:50 2023 OS/Arch: linux/arm64 Experimental: true containerd: Version: 1.6.21 GitCommit: 3dce8eb055cbb6872793272b4f20ed16117344f8 runc: Version: 1.1.7 GitCommit: v1.1.7-0-g860f061 docker-init: Version: 0.19.0 GitCommit: de40ad0 #### Docker settings ![image](https://github.com/slimtoolkit/slim/assets/8701324/c1246348-26eb-4e33-a030-c8223b3efc56) ![image](https://github.com/slimtoolkit/slim/assets/8701324/609135e4-48d4-4813-9143-5a608f1d239f)
Slim version
#### Slim version ```shell 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/slimtoolkit/slim/discussions' cmd=version info=app location='/usr/local/bin' outdated='false' current='1.40.2' verdict='you have the latest version' cmd='version' version='darwin|Transformer|1.40.2|762eea87bafc4b04fe6b0642a62534a148acdaca|2023-05-20_06:13:34AM' container='false' dsimage='false' cmd=version info=host osname='other' osbuild='22F66' version=' Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000' release='22.5.0' sysname='darwin' cmd='version' cmd=version info=docker architecture='aarch64' cmd='version' name='docker-desktop' kernel.version='5.15.49-linuxkit-pr' operating.system='Docker Desktop' ostype='linux' server.version='24.0.2-38-g8e70a1b23e' cmd=version info=dclient api.version='1.43' mini.api.version='1.12' build.time='2023-06-02T15:58:50.000000000+00:00' git.commit='8e70a1b23e965d86ec8c2feb77605196ae124630' cmd='version' 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/slimtoolkit/slim/discussions' ```