Skip to content

Exec error for multi-platform builds of feature layers #946

@MartinLoeper

Description

@MartinLoeper

I already reported the issue in the ci repository, but recognized that it is cli issue, see: devcontainers/ci#305

I just enabled the multi-platform build feature on my machine which runs on x86. I encountered an exec format error during a feature layer build for arm64 as follows:

Start: Run: docker buildx build --platform linux/amd64,linux/arm64 --push --build-context dev_containers_feature_content_source=/tmp/devcontainercli-mloeper/container-features/0.72.0-1737468359115 --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -f /tmp/devcontainercli-mloeper/container-features/0.72.0-1737468359115/Dockerfile.extended -t mloeper/test /tmp/devcontainercli-mloeper/empty-folder
[+] Building 32.2s (23/23) FINISHED          docker-container:container-builder
<skipped>
 => CACHED [linux/amd64 dev_containers_feature_content_normalize 1/3] FRO  0.0s
 => => resolve mcr.microsoft.com/devcontainers/typescript-node:1-22-bookw  0.0s
 => [linux/amd64 dev_containers_target_stage 2/5] RUN mkdir -p /tmp/dev-c  0.2s
 => [linux/amd64 dev_containers_feature_content_normalize 2/3] COPY --fro  0.1s
 => [linux/amd64 dev_containers_feature_content_normalize 3/3] RUN chmod   0.1s
 => [linux/amd64 dev_containers_target_stage 3/5] COPY --from=dev_contain  0.1s
 => [linux/amd64 dev_containers_target_stage 4/5] RUN echo "_CONTAINER_US  0.1s
 => CANCELED [linux/amd64 dev_containers_target_stage 5/5] RUN --mount=t  29.5s
 => [linux/arm64 dev_containers_target_stage 2/5] RUN mkdir -p /tmp/dev-c  0.3s
 => [linux/arm64 dev_containers_feature_content_normalize 2/3] COPY --fro  0.3s
 => [linux/arm64 dev_containers_feature_content_normalize 3/3] RUN chmod   0.1s
 => [linux/arm64 dev_containers_target_stage 3/5] COPY --from=dev_contain  0.0s
 => [linux/arm64 dev_containers_target_stage 4/5] RUN echo "_CONTAINER_US  0.1s
 => ERROR [linux/arm64 dev_containers_target_stage 5/5] RUN --mount=type=  0.2s
------
 > [linux/arm64 dev_containers_target_stage 5/5] RUN --mount=type=bind,from=dev_containers_feature_content_source,source=cosign_0,target=/tmp/build-features-src/cosign_0     cp -ar /tmp/build-features-src/cosign_0 /tmp/dev-container-features  && chmod -R 0755 /tmp/dev-container-features/cosign_0  && cd /tmp/dev-container-features/cosign_0  && chmod +x ./devcontainer-features-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/cosign_0:
0.139 ===========================================================================
0.139 Feature       : Cosign (via Github Releases)
0.139 Description   : Cosign is a command line utility that can sign and verify software artifact, such as container images and blobs.
0.139 Id            : ghcr.io/devcontainers-extra/features/cosign
0.139 Version       : 1.0.9
0.139 Documentation : http://github.com/devcontainers-contrib/features/tree/main/src/cosign
0.139 Options       :
0.139     VERSION="latest"
0.139 ===========================================================================
0.155 Error while loading /tmp/dev-container-features/cosign_0/./install.sh: Exec format error
0.156 ERROR: Feature "Cosign (via Github Releases)" (ghcr.io/devcontainers-extra/features/cosign) failed to install! Look at the documentation at http://github.com/devcontainers-contrib/features/tree/main/src/cosign for help troubleshooting this error.
------
Dockerfile.extended:24
--------------------
  23 |
  24 | >>> RUN --mount=type=bind,from=dev_containers_feature_content_source,source=cosign_0,target=/tmp/build-features-src/cosign_0 \
  25 | >>>     cp -ar /tmp/build-features-src/cosign_0 /tmp/dev-container-features \
  26 | >>>  && chmod -R 0755 /tmp/dev-container-features/cosign_0 \
  27 | >>>  && cd /tmp/dev-container-features/cosign_0 \
  28 | >>>  && chmod +x ./devcontainer-features-install.sh \
  29 | >>>  && ./devcontainer-features-install.sh \
  30 | >>>  && rm -rf /tmp/dev-container-features/cosign_0
  31 |
--------------------
ERROR: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c cp -ar /tmp/build-features-src/cosign_0 /tmp/dev-container-features  && chmod -R 0755 /tmp/dev-container-features/cosign_0  && cd /tmp/dev-container-features/cosign_0  && chmod +x ./devcontainer-features-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/cosign_0" did not complete successfully: exit code: 1
{"outcome":"error","message":"Command failed: docker buildx build --platform linux/amd64,linux/arm64 --push --build-context dev_containers_feature_content_source=/tmp/devcontainercli-mloeper/container-features/0.72.0-1737468359115 --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -f /tmp/devcontainercli-mloeper/container-features/0.72.0-1737468359115/Dockerfile.extended -t mloeper/test /tmp/devcontainercli-mloeper/empty-folder","description":"An error occurred building the container."}

Minimal Reproducible Example

build.sh:

devcontainer build --platform linux/amd64,linux/arm64 --workspace-folder . --push --image-name "yourrepo/test"

.devcontainer/devcontainer.json:

{
	"name": "MRE",
	"image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm",
	"features": {
		"ghcr.io/devcontainers-extra/features/cosign:1": {}
	}
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions