ottomatica/slim

Error building image

kewp opened this issue · 6 comments

kewp commented

After running slim build images/alpine3.8-simple I get:

building docker image
Step 1/28 : FROM alpine:3.8.4 AS openrc
 ---> c2b4b73a5fef
Step 2/28 : RUN mkdir -p /lib/apk/db /run
 ---> Using cache
 ---> bd1006585f67
Step 3/28 : RUN apk add --no-cache --initdb openrc
 ---> Using cache
 ---> 5e63b6e9e35a
Step 4/28 : FROM alpine:3.8.4 AS kernel
 ---> c2b4b73a5fef
Step 5/28 : RUN mkdir -p /lib/apk/db /run
 ---> Using cache
 ---> bd1006585f67
Step 6/28 : RUN apk add --no-cache --initdb linux-virt virtualbox-guest-modules-virt
 ---> Running in 44c71b3e49cf
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/aarch64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/aarch64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
  linux-virt (missing):
    required by: world[linux-virt]
  virtualbox-guest-modules-virt (missing):
    required by:
                 world[virtualbox-guest-modules-virt]
exporting docker filesystem
Error: (HTTP code 404) no such container - No such image: slim-vm:latest

I'm running on an M1 mac...

Thanks for trying Slim @kewp!

It seems the Docker build is failing because it wasn't able to install linux-virt, so I investigated more to see if it is available in Alpine Linux repositories. They have this package in the repository but for anything newer than version 3.8 (see here).

Could you try the build command again with a newer version of Alpine, and let me know how that goes? (I currently don't have an M1 machine to test this right now)

kewp commented

hey @ssmirr see below:

% slim build images/alpine3.12-simple
building docker image
Step 1/27 : FROM alpine:3.12 AS openrc
 ---> 64901ebf3307
Step 2/27 : RUN mkdir -p /lib/apk/db /run
 ---> Running in 1d5c8b5c56f3
Removing intermediate container 1d5c8b5c56f3
 ---> 6687b52a663f
Step 3/27 : RUN apk add --no-cache --initdb openrc
 ---> Running in 1aae608e2b00
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/aarch64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/aarch64/APKINDEX.tar.gz
(1/1) Installing openrc (0.42.1-r12)
Executing openrc-0.42.1-r12.post-install
Executing busybox-1.31.1-r21.trigger
OK: 8 MiB in 15 packages
Removing intermediate container 1aae608e2b00
 ---> ef592d7689c5
Step 4/27 : FROM alpine:3.12 AS kernel
 ---> 64901ebf3307
Step 5/27 : RUN mkdir -p /lib/apk/db /run
 ---> Using cache
 ---> 6687b52a663f
Step 6/27 : RUN apk add --no-cache --initdb linux-virt virtualbox-guest-modules-virt
 ---> Running in 9f7db43147a6
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/aarch64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/aarch64/APKINDEX.tar.gz
ERROR: unable to select packages:
  virtualbox-guest-modules-virt (no such package):
    required by: world[virtualbox-guest-modules-virt]
exporting docker filesystem
Error: (HTTP code 404) no such container - No such image: slim-vm:latest 

@kewp

The underlying issue is that virtual box is not available on aarch64 (arm64) architecture, but the example Dockerfile can't install that package.

I've added an example Dockerfile that removes those dependencies. This build should be usable on kvm or any provider that can boot an image from kernel, and initrd.

https://github.com/ottomatica/slim/tree/master/images/alpine3.12-raw

kewp commented

got pretty far but then got this:

creating initrd
Error: Cannot find module 'cpio-fs'
Require stack:
- /Users/karl/tst/slim/lib/build.js
- /Users/karl/tst/slim/lib/commands/build.js
- /Users/karl/tst/slim/node_modules/yargs/index.js
- /Users/karl/tst/slim/index.js

You should just need to run npm i in the slim directory to update the dependencies. There was a new npm dependency added to remove the need for the system dependency on cpio.

kewp commented

Thanks that worked.