Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexer: Docker Image Build Fails Due to exec format error (Platform Mismatch) #2472

Open
josusanmartin opened this issue Oct 4, 2024 · 1 comment
Labels

Comments

@josusanmartin
Copy link

josusanmartin commented Oct 4, 2024

Disclaimer: This bug report has been produced with chatGPT, however it is accurate to the extent of my understanding.

Description

When attempting to build the services for the dYdX V4 Indexer, specifically using indexer/Dockerfile.service.local, the build fails due to a platform architecture mismatch. The Dockerfile is using the base image dydxprotocol/indexer-node:16-alpine-m1, which is built for linux/arm64. However, the local machine or Docker setup is expecting an image built for linux/amd64.

Steps to Reproduce

  1. Clone the dYdX V4 Indexer repository.
  2. Navigate to the indexer directory.
  3. Run the following command:
    docker-compose -f docker-compose-local-deployment.yml build
  4. Observe the error message.

Expected Behavior

The Docker build should succeed without a platform mismatch error.

Actual Behavior

The Docker build fails with the following error:

 InvalidBaseImagePlatform: Base image dydxprotocol/indexer-node:16-alpine-m1 was pulled with platform "linux/arm64", expected "linux/amd64" for current build (line 2)
Dockerfile.service.local:6

This error occurs because the base image dydxprotocol/indexer-node:16-alpine-m1 was pulled with platform linux/arm64, but the expected platform is linux/amd64.

Proposed Solution

To resolve this issue for Ubuntu (amd64), the base image in indexer/Dockerfile.service.local should be changed from dydxprotocol/indexer-node:16-alpine-m1 to an amd64 compatible version, such as:

FROM node:16-alpine

This change ensures that the correct platform image is used, avoiding the exec format error during the build.

Note: This solution is specific to Ubuntu (amd64) and may not work for ARM-based systems (e.g., Mac M1/M2). To support multiple architectures, a platform-agnostic solution using Docker's buildx feature or multi-platform images should be considered.

Environment

  • OS: Ubuntu 22.04
  • Node.js Version: v22.9.0
  • Docker Version: Latest
  • pnpm Version: 9.12.0

Logs

 > [ 2/28] RUN apk add --no-cache bash jq aws-cli:
0.263 exec /bin/sh: exec format error
------

 1 warning found (use docker --debug to expand):
 - InvalidBaseImagePlatform: Base image dydxprotocol/indexer-node:16-alpine-m1 was pulled with platform "linux/arm64", expected "linux/amd64" for current build (line 2)
Dockerfile.service.local:6
--------------------
   4 |     ARG service
   5 |
   6 | >>> RUN apk add --no-cache bash jq aws-cli
   7 |     RUN adduser -S dydx
   8 |     RUN mkdir -p /home/dydx/app
--------------------
ERROR: failed to solve: process "/bin/sh -c apk add --no-cache bash jq aws-cli" did not complete successfully: exit code: 1
ERROR: Service 'ender' failed to build : Build failed

Additional Information

This issue is specific to the platform mismatch between arm64 and amd64 architectures in the Docker base image used in indexer/Dockerfile.service.local.

@josusanmartin josusanmartin changed the title Bug Report: Docker Image Build Fails Due to exec format error (Platform Mismatch) Indexer: Docker Image Build Fails Due to exec format error (Platform Mismatch) Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant