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
18.85k stars 702 forks source link

API version incorrect #637

Open genevera opened 5 months ago

genevera commented 5 months ago

Expected Behavior

slim builds an image


Actual Behavior

I get an error about API versions, "cmd=build info=build.error status='standard.image.build.error' value='API /build requires version 1.25, requested version 1.24 is insufficient'"

slim build --dockerfile ./Dockerfile --tag image-name:slim --cbo-build-arg BUILD_ARG=arg --dockerfile-context $(pwd)
cmd=build info=param.http.probe message='using default probe'
cmd=build state=started
cmd=build info=params rt.as.user='true' keep.perms='true' image-build-engine='internal' target.type='dockerfile' context='/Users/genevera/src/image-name' file='./Dockerfile' continue.mode='probe'
cmd=build state=building message="building basic image"
cmd=build info=basic.image.info tag='image-name.fat:slim' dockerfile='./Dockerfile' context='/Users/genevera/src/image-name'
cmd=build log='regular.image.build' event=LOG.START tag='image-name.fat:slim'  ====================

cmd=build log='regular.image.build' event=LOG.END tag='image-name.fat:slim'  ====================
cmd=build info=build.error status='standard.image.build.error' value='API /build requires version 1.25, requested version 1.24 is insufficient'
cmd=build state=exited code=33554435 version=darwin/arm64|Transformer|1.40.11|latest|latest location=/opt/homebrew/bin
cmd=build info=report file='slim.report.json'
cmd=build info=exit code='33554435' version='darwin/arm64|Transformer|1.40.11|latest|latest' location='/opt/homebrew/bin'
app='slim' message='GitHub Discussions' info='https://github.com/slimtoolkit/slim/discussions'
app='slim' message='Join the CNCF Slack channel to ask questions or to share your feedback' info='https://cloud-native.slack.com/archives/C059QP1RH1S'
app='slim' message='Join the Discord server to ask questions or to share your feedback' info='https://discord.gg/9tDyxYS'
app='slim' message='Join the Gitter channel to ask questions or to share your feedback' info='https://gitter.im/docker-slim/community'

Steps to Reproduce the Problem

1. run slim build --- Specifications ================= - Version: 1.40.11 - Platform: darwin/arm64
kcq commented 5 months ago

This is possibly related to the --dockerfile flag... One work around is to let Docker build the original image, so you don't need to use the --dockerfile flag. Another workaround is to try the --crt-api-version global flag to specify the Docker API version to use there: slim --crt-api-version=1.25 build --dockerfile ./Dockerfile --tag image-name:slim --cbo-build-arg BUILD_ARG=arg --dockerfile-context $(pwd)

genevera commented 5 months ago

Unfortunately, using --crt-api-version=1.25 or --crt-api-version 1.25 results in the following error: time="2024-02-03T04:52:54-05:00" level=fatal msg="flag provided but not defined: -crt-api-version"

genevera commented 5 months ago

That last comment was all PEBKAC. I moved --crt-api-version before the verb and the error stopped.

genevera commented 5 months ago

I notice when trying to build from dockerfile that I get the following error no matter if i use --image-build-arch amd64 and/or --platform=$BUILDPLATFORM in the dockerfile:

cmd=build info=build.error value='no matching manifest for linux/arm64/v8 in the manifest list entries' status='standard.image.build.error'

It does appear to work when using an extant image, however.

demonshreder commented 4 months ago

Want to confirm this behaviour

slimtoolkit version : 1.40.11 docker (client + engine) version: 24.0.7 OS: Arch Linux x64

iximiuz commented 4 months ago

Hey folks! Thanks for reporting! It'll likely be fixed in the next release by #641.