cartesi / docs

SDK documentation
31 stars 48 forks source link

Update doc to installation instructions for Docker RISC-V support #193

Closed sandhilt closed 5 months ago

sandhilt commented 5 months ago

The problem

In some cases, people use CLI for handle Docker images and could be a obstacle to handle RISC-V architecture because of error is no self explain.

How to simulate

  1. Download Docker.
  2. Install docker buildx and docker compose.
  3. Install node and npm.
  4. Create a project with Javascript, for i.e.
  5. Run cartesi build
  6. After ADD machine-emulator, the process of install Debian package, crashes.
=> => transferring context: 238B                                                                                  0.0s
 => [stage-1 1/6] FROM docker.io/cartesi/node:20.8.0-jammy-slim@sha256:47b872074fd14b8ff23452a7e2886ff91675671f00  0.0s
 => CACHED [stage-1 2/6] ADD https://github.com/cartesi/machine-emulator-tools/releases/download/v0.14.1/machine-  0.0s
 => ERROR [stage-1 3/6] RUN dpkg -i /machine-emulator-tools-v0.14.1.deb   && rm /machine-emulator-tools-v0.14.1.d  1.6s
------
 > [stage-1 3/6] RUN dpkg -i /machine-emulator-tools-v0.14.1.deb   && rm /machine-emulator-tools-v0.14.1.deb:
1.314 exec /bin/sh: exec format error
------
Dockerfile:24
--------------------
  23 |     ADD https://github.com/cartesi/machine-emulator-tools/releases/download/v${MACHINE_EMULATOR_TOOLS_VERSION}/machine-emulator-tools-v${MACHINE_EMULATOR_TOOLS_VERSION}.deb /
  24 | >>> RUN dpkg -i /machine-emulator-tools-v${MACHINE_EMULATOR_TOOLS_VERSION}.deb \
  25 | >>>   && rm /machine-emulator-tools-v${MACHINE_EMULATOR_TOOLS_VERSION}.deb
  26 |
--------------------
ERROR: failed to solve: process "/bin/sh -c dpkg -i /machine-emulator-tools-v${MACHINE_EMULATOR_TOOLS_VERSION}.deb   && rm /machine-emulator-tools-v${MACHINE_EMULATOR_TOOLS_VERSION}.deb" did not complete successfully: exit code: 1
    Error: Command failed with exit code 1: docker buildx build --load --iidfile /tmp/tmp-40925-tQXwwcaB3YB9
``````shell
=> => transferring context: 238B                                                                                  0.0s
 => [stage-1 1/6] FROM docker.io/cartesi/node:20.8.0-jammy-slim@sha256:47b872074fd14b8ff23452a7e2886ff91675671f00  0.0s
 => CACHED [stage-1 2/6] ADD https://github.com/cartesi/machine-emulator-tools/releases/download/v0.14.1/machine-  0.0s
 => ERROR [stage-1 3/6] RUN dpkg -i /machine-emulator-tools-v0.14.1.deb   && rm /machine-emulator-tools-v0.14.1.d  1.6s
------
 > [stage-1 3/6] RUN dpkg -i /machine-emulator-tools-v0.14.1.deb   && rm /machine-emulator-tools-v0.14.1.deb:
1.314 exec /bin/sh: exec format error
------
Dockerfile:24
--------------------
  23 |     ADD https://github.com/cartesi/machine-emulator-tools/releases/download/v${MACHINE_EMULATOR_TOOLS_VERSION}/machine-emulator-tools-v${MACHINE_EMULATOR_TOOLS_VERSION}.deb /
  24 | >>> RUN dpkg -i /machine-emulator-tools-v${MACHINE_EMULATOR_TOOLS_VERSION}.deb \
  25 | >>>   && rm /machine-emulator-tools-v${MACHINE_EMULATOR_TOOLS_VERSION}.deb
  26 |
--------------------
ERROR: failed to solve: process "/bin/sh -c dpkg -i /machine-emulator-tools-v${MACHINE_EMULATOR_TOOLS_VERSION}.deb   && rm /machine-emulator-tools-v${MACHINE_EMULATOR_TOOLS_VERSION}.deb" did not complete successfully: exit code: 1
    Error: Command failed with exit code 1: docker buildx build --load --iidfile /tmp/tmp-40925-tQXwwcaB3YB9

Workaround

Add some info about support of RISC-V based in documentation from Sunodo https://docs.sunodo.io/guide/introduction/installing#system-requirements. See changes in this PR.

A alternative could be handle yourself with docker buildx like:

  1. Create a emulator:
docker buildx create --name mybuilder --use --bootstrap --platform linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/386,linux/riscv64
  1. Check emulator:
docker buildx ls
  1. Remove inactive emulators:
docker buildx rm --all-inactive