chainguard-dev / apko

Build OCI images from APK packages directly without Dockerfile
https://apko.dev
Apache License 2.0
1.2k stars 119 forks source link

initializing apk: failed to fixate apk world: exit status #336

Closed LarsKrogJensen closed 2 years ago

LarsKrogJensen commented 2 years ago

Trying to build the first example mentioned on a mac pro x86 with docker desktop, but it fails:

09:04 $ docker run -v "$PWD":/work distroless.dev/apko build examples/alpine-base.yaml apko-alpine:edge apko-alpine.tar
Aug 25 07:04:02.334 [INFO] loading config file: examples/alpine-base.yaml
Aug 25 07:04:02.342 [INFO] [arch:x86_64] WARNING: ignoring archs in config, only building for current arch (amd64)
Aug 25 07:04:02.342 [INFO] [arch:x86_64] building image 'apko-alpine:edge'
Aug 25 07:04:02.342 [INFO] [arch:x86_64] build context:
Aug 25 07:04:02.342 [INFO] [arch:x86_64]   working directory: /tmp/apko-2434288168
Aug 25 07:04:02.342 [INFO] [arch:x86_64]   tarball path:
Aug 25 07:04:02.342 [INFO] [arch:x86_64]   use proot: false
Aug 25 07:04:02.342 [INFO] [arch:x86_64]   source date: 1970-01-01 00:00:00 +0000 UTC
Aug 25 07:04:02.342 [INFO] [arch:x86_64]   Docker mediatypes: false
Aug 25 07:04:02.342 [INFO] [arch:x86_64]   SBOM output path: /work
Aug 25 07:04:02.342 [INFO] [arch:x86_64]   arch: x86_64
Aug 25 07:04:02.342 [INFO] [arch:x86_64] image configuration:
Aug 25 07:04:02.342 [INFO] [arch:x86_64]   contents:
Aug 25 07:04:02.342 [INFO] [arch:x86_64]     repositories: [https://dl-cdn.alpinelinux.org/alpine/edge/main]
Aug 25 07:04:02.342 [INFO] [arch:x86_64]     keyring:      []
Aug 25 07:04:02.342 [INFO] [arch:x86_64]     packages:     [alpine-base]
Aug 25 07:04:02.342 [INFO] [arch:x86_64]   entrypoint:
Aug 25 07:04:02.342 [INFO] [arch:x86_64]     type:
Aug 25 07:04:02.342 [INFO] [arch:x86_64]     command:     /bin/sh -l
Aug 25 07:04:02.342 [INFO] [arch:x86_64]     service: map[]
Aug 25 07:04:02.342 [INFO] [arch:x86_64]     shell fragment:
Aug 25 07:04:02.342 [INFO] [arch:x86_64] doing pre-flight checks
Aug 25 07:04:02.342 [INFO] [arch:x86_64] building image fileystem in /tmp/apko-2434288168
Aug 25 07:04:02.342 [INFO] [arch:x86_64] initializing apk database
Aug 25 07:04:02.342 [INFO] [arch:x86_64] [cmd:apk] [use-proot:false] [use-qemu:] running: /sbin/apk add --initdb --arch x86_64 --root /tmp/apko-2434288168
Aug 25 07:04:02.346 [INFO] [arch:x86_64] initializing apk world
Aug 25 07:04:02.347 [INFO] [arch:x86_64] initializing apk keyring
Aug 25 07:04:02.347 [INFO] [arch:x86_64] initializing apk repositories
Aug 25 07:04:02.347 [INFO] [arch:x86_64] synchronizing with desired apk world
Aug 25 07:04:02.347 [INFO] [arch:x86_64] [cmd:apk] [use-proot:false] [use-qemu:] running: /sbin/apk fix --root /tmp/apko-2434288168 --no-scripts --no-cache --update-cache --arch x86_64
Error: failed to build layer image: initializing apk: failed to fixate apk world: exit status 1
2022/08/25 07:04:02 error during command execution: failed to build layer image: initializing apk: failed to fixate apk world: exit status 1

apko version

09:06 $ docker run distroless.dev/apko version


/ \    |  _ \  | |/ /  / _ \

/ \ | |) | | ' / | | | | / _ \ | _/ | . \ | || | // _\ || ||_\ \/ apko

GitVersion: v0.5.0-92-g1e2e81a GitCommit: 1e2e81a71166ab042cbfdf9b712a861c8751a038 GitTreeState: clean BuildDate: '1970-01-01T00:00:00Z' GoVersion: go1.19 Compiler: gc Platform: linux/amd64

docker version:

09:00 $ docker version Client: Cloud integration: v1.0.28 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/amd64 Context: default Experimental: true

Server: Docker Desktop 4.11.1 (84025) 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:23 2022 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.6 GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1 runc: Version: 1.1.2 GitCommit: v1.1.2-0-ga916309 docker-init: Version: 0.19.0 GitCommit: de40ad0

kaniini commented 2 years ago

Try with --debug and paste the log, but most likely the alpine mirror was just down.

LarsKrogJensen commented 2 years ago

Still the same issue, with --debug

10:20 $ docker run -v "$PWD":/work distroless.dev/apko build --debug examples/alpine-base.yaml apko-alpine:edge apko-alpine.tar Aug 29 08:21:09.050 [INFO] loading config file: examples/alpine-base.yaml Aug 29 08:21:09.057 [DEBUG] [arch:x86_64] failed to probe VCS URL: opening git repository: directory /work/examples is not in a git repository Aug 29 08:21:09.057 [INFO] [arch:x86_64] building image 'apko-alpine:edge' Aug 29 08:21:09.057 [INFO] [arch:x86_64] build context: Aug 29 08:21:09.057 [INFO] [arch:x86_64] working directory: /tmp/apko-2761677971 Aug 29 08:21:09.057 [INFO] [arch:x86_64] tarball path: Aug 29 08:21:09.057 [INFO] [arch:x86_64] use proot: false Aug 29 08:21:09.057 [INFO] [arch:x86_64] source date: 1970-01-01 00:00:00 +0000 UTC Aug 29 08:21:09.057 [INFO] [arch:x86_64] Docker mediatypes: false Aug 29 08:21:09.057 [INFO] [arch:x86_64] SBOM output path: /work Aug 29 08:21:09.057 [INFO] [arch:x86_64] arch: x86_64 Aug 29 08:21:09.057 [INFO] [arch:x86_64] image configuration: Aug 29 08:21:09.057 [INFO] [arch:x86_64] contents: Aug 29 08:21:09.057 [INFO] [arch:x86_64] repositories: [https://dl-cdn.alpinelinux.org/alpine/edge/main] Aug 29 08:21:09.057 [INFO] [arch:x86_64] keyring: [] Aug 29 08:21:09.057 [INFO] [arch:x86_64] packages: [alpine-base] Aug 29 08:21:09.057 [INFO] [arch:x86_64] entrypoint: Aug 29 08:21:09.057 [INFO] [arch:x86_64] type: Aug 29 08:21:09.057 [INFO] [arch:x86_64] command: /bin/sh -l Aug 29 08:21:09.057 [INFO] [arch:x86_64] service: map[] Aug 29 08:21:09.057 [INFO] [arch:x86_64] shell fragment: Aug 29 08:21:09.057 [INFO] [arch:x86_64] doing pre-flight checks Aug 29 08:21:09.057 [INFO] [arch:x86_64] building image fileystem in /tmp/apko-2761677971 Aug 29 08:21:09.057 [INFO] [arch:x86_64] initializing apk database Aug 29 08:21:09.058 [INFO] [arch:x86_64] [cmd:apk] [use-proot:false] [use-qemu:] running: /sbin/apk add --initdb --arch x86_64 --root /tmp/apko-2761677971 Aug 29 08:21:09.062 [DEBUG] [arch:x86_64] [cmd:apk] [use-proot:false] [use-qemu:] OK: 0 MiB in 0 packages Aug 29 08:21:09.063 [INFO] [arch:x86_64] initializing apk world Aug 29 08:21:09.063 [INFO] [arch:x86_64] initializing apk keyring Aug 29 08:21:09.063 [INFO] [arch:x86_64] initializing apk repositories Aug 29 08:21:09.063 [DEBUG] [arch:x86_64] installing key /usr/share/apk/keys/x86_64/alpine-devel@lists.alpinelinux.org-6165ee59.rsa.pub Aug 29 08:21:09.063 [DEBUG] [arch:x86_64] installing key /usr/share/apk/keys/x86_64/alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub Aug 29 08:21:09.063 [DEBUG] [arch:x86_64] installing key /usr/share/apk/keys/x86_64/alpine-devel@lists.alpinelinux.org-5261cecb.rsa.pub Aug 29 08:21:09.064 [INFO] [arch:x86_64] synchronizing with desired apk world Aug 29 08:21:09.064 [INFO] [arch:x86_64] [cmd:apk] [use-proot:false] [use-qemu:] running: /sbin/apk fix --root /tmp/apko-2761677971 --no-scripts --no-cache --update-cache --arch x86_64 Aug 29 08:21:09.068 [DEBUG] [arch:x86_64] [cmd:apk] [use-proot:false] [use-qemu:] fetch https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz Aug 29 08:21:09.478 [DEBUG] [arch:x86_64] [cmd:apk] [use-proot:false] [use-qemu:] WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/edge/main: Permission denied Aug 29 08:21:09.478 [DEBUG] [arch:x86_64] [cmd:apk] [use-proot:false] [use-qemu:] ERROR: unable to select packages: Aug 29 08:21:09.479 [DEBUG] [arch:x86_64] [cmd:apk] [use-proot:false] [use-qemu:] alpine-base (no such package): Aug 29 08:21:09.479 [DEBUG] [arch:x86_64] [cmd:apk] [use-proot:false] [use-qemu:] required by: world[alpine-base] Error: failed to build layer image: initializing apk: failed to fixate apk world: exit status 1 2022/08/29 08:21:09 error during command execution: failed to build layer image: initializing apk: failed to fixate apk world: exit status 1

kaniini commented 2 years ago

That permission denied error is strange, its coming from apk. Probably SSL related, or such. Is your system clock up to date?

LarsKrogJensen commented 2 years ago

yep it is well synced

LarsKrogJensen commented 2 years ago

could it be a proxy auth issue?

kaniini commented 2 years ago

could be! are you passing through your proxy env variables to docker?

LarsKrogJensen commented 2 years ago

proxy issue indeed, getting of corporate network solve my issue