ktock/container2wasm

Fail to transform locally built image: `panic: unsupported mediatype application/vnd.oci.image.index.v1+json`

steren opened this issue · 4 comments

steren commented

I have no issue transforming images from DockerHub like alpine

But an image I built locally with the following Dockerfile

FROM alpine:3.14
RUN apk add inkscape
ENTRYPOINT ["inkscape"]

errors:

#21 [bundle-dev 5/7] RUN mkdir -p /out/oci/rootfs /out/oci/bundle &&     IS_WIZER=false &&     if test "wizer" = "wizer" ; then IS_WIZER=true ; fi &&     NO_VMTOUCH_F=false &&     if test "wizer" = "native" ; then NO_VMTOUCH_F=true ; fi &&     if test "" != "" ; then NO_VMTOUCH_F="" ; fi &&     EXTERNAL_BUNDLE_F=false &&     if test "" = "true" ; then EXTERNAL_BUNDLE_F=true ; fi &&     create-spec --debug=false --debug-init=${IS_WIZER} --no-vmtouch=${NO_VMTOUCH_F} --external-bundle=${EXTERNAL_BUNDLE_F}                 --image-config-path=/oci/image.json                 --runtime-config-path=/oci/spec.json                 --rootfs-path=/oci/rootfs                 /oci "linux/amd64" /out/oci/rootfs
#21 0.356 Trying to unpack image as an OCI image
#21 0.359 panic: unsupported mediatype application/vnd.oci.image.index.v1+json
#21 0.359
#21 0.359 goroutine 1 [running]:
#21 0.359 main.main()
#21 0.359       /work/cmd/create-spec/main.go:57 +0x5ac
#21 ERROR: process "/bin/sh -c mkdir -p /out/oci/rootfs /out/oci/bundle &&     IS_WIZER=false &&     if test \"${OPTIMIZATION_MODE}\" = \"wizer\" ; then IS_WIZER=true ; fi &&     NO_VMTOUCH_F=false &&     if test \"${OPTIMIZATION_MODE}\" = \"native\" ; then NO_VMTOUCH_F=true ; fi &&     if test \"${NO_VMTOUCH}\" != \"\" ; then NO_VMTOUCH_F=\"${NO_VMTOUCH}\" ; fi &&     EXTERNAL_BUNDLE_F=false &&     if test \"${EXTERNAL_BUNDLE}\" = \"true\" ; then EXTERNAL_BUNDLE_F=true ; fi &&     create-spec --debug=${INIT_DEBUG} --debug-init=${IS_WIZER} --no-vmtouch=${NO_VMTOUCH_F} --external-bundle=${EXTERNAL_BUNDLE_F}                 --image-config-path=/oci/image.json                 --runtime-config-path=/oci/spec.json                 --rootfs-path=/oci/rootfs                 /oci \"${TARGETPLATFORM}\" /out/oci/rootfs" did not complete successfully: exit code: 2
------
 > [bundle-dev 5/7] RUN mkdir -p /out/oci/rootfs /out/oci/bundle &&     IS_WIZER=false &&     if test "wizer" = "wizer" ; then IS_WIZER=true ; fi &&     NO_VMTOUCH_F=false &&     if test "wizer" = "native" ; then NO_VMTOUCH_F=true ; fi &&     if test "" != "" ; then NO_VMTOUCH_F="" ; fi &&     EXTERNAL_BUNDLE_F=false &&     if test "" = "true" ; then EXTERNAL_BUNDLE_F=true ; fi &&     create-spec --debug=false --debug-init=${IS_WIZER} --no-vmtouch=${NO_VMTOUCH_F} --external-bundle=${EXTERNAL_BUNDLE_F}                 --image-config-path=/oci/image.json                 --runtime-config-path=/oci/spec.json                 --rootfs-path=/oci/rootfs                 /oci "linux/amd64" /out/oci/rootfs:
0.356 Trying to unpack image as an OCI image
0.359 panic: unsupported mediatype application/vnd.oci.image.index.v1+json
0.359
0.359 goroutine 1 [running]:
0.359 main.main()
0.359   /work/cmd/create-spec/main.go:57 +0x5ac
------
container2wasm3268470491:59
--------------------
  58 |     # <vm-rootfs>/oci/initconfig.json : configuration file for init
  59 | >>> RUN mkdir -p /out/oci/rootfs /out/oci/bundle && \
  60 | >>>     IS_WIZER=false && \
  61 | >>>     if test "${OPTIMIZATION_MODE}" = "wizer" ; then IS_WIZER=true ; fi && \
  62 | >>>     NO_VMTOUCH_F=false && \
  63 | >>>     if test "${OPTIMIZATION_MODE}" = "native" ; then NO_VMTOUCH_F=true ; fi && \
  64 | >>>     if test "${NO_VMTOUCH}" != "" ; then NO_VMTOUCH_F="${NO_VMTOUCH}" ; fi && \
  65 | >>>     EXTERNAL_BUNDLE_F=false && \
  66 | >>>     if test "${EXTERNAL_BUNDLE}" = "true" ; then EXTERNAL_BUNDLE_F=true ; fi && \
  67 | >>>     create-spec --debug=${INIT_DEBUG} --debug-init=${IS_WIZER} --no-vmtouch=${NO_VMTOUCH_F} --external-bundle=${EXTERNAL_BUNDLE_F} \
  68 | >>>                 --image-config-path=/oci/image.json \
  69 | >>>                 --runtime-config-path=/oci/spec.json \
  70 | >>>                 --rootfs-path=/oci/rootfs \
  71 | >>>                 /oci "${TARGETPLATFORM}" /out/oci/rootfs
  72 |     RUN if test -f image.json; then mv image.json /out/oci/ ; fi && \
--------------------
ERROR: failed to solve: process "/bin/sh -c mkdir -p /out/oci/rootfs /out/oci/bundle &&     IS_WIZER=false &&     if test \"${OPTIMIZATION_MODE}\" = \"wizer\" ; then IS_WIZER=true ; fi &&     NO_VMTOUCH_F=false &&     if test \"${OPTIMIZATION_MODE}\" = \"native\" ; then NO_VMTOUCH_F=true ; fi &&     if test \"${NO_VMTOUCH}\" != \"\" ; then NO_VMTOUCH_F=\"${NO_VMTOUCH}\" ; fi &&     EXTERNAL_BUNDLE_F=false &&     if test \"${EXTERNAL_BUNDLE}\" = \"true\" ; then EXTERNAL_BUNDLE_F=true ; fi &&     create-spec --debug=${INIT_DEBUG} --debug-init=${IS_WIZER} --no-vmtouch=${NO_VMTOUCH_F} --external-bundle=${EXTERNAL_BUNDLE_F}                 --image-config-path=/oci/image.json                 --runtime-config-path=/oci/spec.json                 --rootfs-path=/oci/rootfs                 /oci \"${TARGETPLATFORM}\" /out/oci/rootfs" did not complete successfully: exit code: 2
exit status 1
ktock commented

Thanks for reporting this issue. I'm trying to fix it at #208

ktock commented

The patch has been merged and tagged as v0.6.1. Please try v0.6.1 https://github.com/ktock/container2wasm/releases/tag/v0.6.1

steren commented

I confirm this specific error is gone

steren commented

I am now running into this error with the same image: #210