slimtoolkit / slimtoolkit/slim

Slim build failed for any image on the Apple M1 (ARM)

Open
#539 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
Go
Stars
23.4k
Forks
840
PR merge metrics
No merged PRs in 30d

Description

I'm following (on mac M1) by how-to guide from the main README page and getn an error with the base example:

>> slim build --target archlinux:latest --tag archlinux:curl --http-probe=false --exec "curl checkip.amazonaws.com"
> ...

And get an error like:

level=error msg="dockerutil.BuildEmptyImage: dockerapi.BuildImage() error = invalid reference format"
level=fatal msg="slim: failure" error="invalid reference format"

Expected Behavior

>> docker images
archlinux                 curl                ...        ...         17.4MB
archlinux                 latest              ...        ...         467MB

Actual Behavior

level=error msg="dockerutil.BuildEmptyImage: dockerapi.BuildImage() error = invalid reference format"
level=fatal msg="slim: failure" error="invalid reference format"
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"

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 <santiago@archlinux.org> (@SantiagoTorres), Christian Rebischke <Chris.Rebischke@archlinux.org> (@shibumi), Justin Kromlinger <hashworks@archlinux.org> (@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

  1. Run slim --debug build --target archlinux:latest --tag archlinux:curl --http-probe=false --exec "curl checkip.amazonaws.com"

Specifications

  • MacOS version: 13.4 (22F66), Slim version: 1.40.2
  • Platform: Apple M1 Pro
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
image

Slim version

Slim 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'
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'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pkg/app/master/inspectors/container/container_inspector.go around line 430, where ensureSensorVolume calls dockerutil.BuildEmptyImage and fails on Apple M1. Reproduce the documented slim build command with Docker Desktop on darwin/arm64, then trace the Docker API request that returns "invalid reference format". Done means the build completes and produces the requested archlinux:curl image.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.