DAML image for multi platforms

Hello,
I am working on a DAML project and recently switched to an M1 based mac.

Running a docker compose configuration with the daml sandbox and multiple other services I noticed that the daml sandbox command in the entry point of my container throws a segmentation fault.

daml sandbox --dar daml-*.dar -c sandbox.conf 
>  8 Segmentation fault      daml sandbox --dar daml-*.dar -c sandbox.conf 

Is there any plan for a multi platform or arm-based image?
Any simple way of running the daml image on arm-based machines?

Thanks in advance!


The details of the setup :arrow_down: :

My docker file for the daml sandbox container

ARG SDK_VERSION=2.0.0
FROM digitalasset/daml-sdk:${SDK_VERSION}

USER root
RUN apt-get update
RUN apt-get install netcat -y

My docker compose file:

version: '3.8'

services:

  daml-sandbox:
    container_name: daml-sandbox
    platform: linux/arm64    # <--- I tried with and without platform specification
    build:
      context: ../../.
      dockerfile: Dockerfile
    image: daml
    command: ./run-sandbox.sh
    ports:
      - "6865:6865"
      - "10012:10012"
      - "10019:10019"

My run-sandbox.sh entry point

daml sandbox --dar daml-*.dar -c sandbox.conf  

My sandbox.conf:

canton {
  participants {
    sandbox {
      ledger-api {
        port = 6865
        address = 0.0.0.0
      }
      admin-api {
        port = 10012
        address = 0.0.0.0
      }
    }
  }
  monitoring.health {
    server {
      address = 0.0.0.0
      port = 10019
    }

    check {
      type = ping
      participant = sandbox
      interval = 30s
    }
  }
}

Hi @francescobenintende,

We do not currently provide M1-ready Docker images. Your best bet at this point is to build them yourself; as a starting point, the Dockerfile for these images is here.

I am facing the same segmentation issue. I have tried to build a docker image . I updated the docker file, basically changed the first line

FROM eclipse-temurin:11 -> FROM arm64v8/eclipse-temurin:11

And I have the same issue with both versions of eclipse.

I also tried interactively installing SDK

atttempt 1 : arm64v8/eclipse-temurin:11

ashokraj@ashokrajwhx5j3 ~ % docker run -it --entrypoint sh arm64v8/eclipse-temurin:11
# 
# curl -sSL https://get.daml.com/ | sh
Determining latest SDK version...
Latest SDK version is 2.2.0
Downloading SDK 2.2.0. This may take a while.
######################################################################## 100.0%
Extracting SDK release tarball.
/tmp/tmp.SkEM23Mdu1/sdk/install.sh: line 5:    34 Segmentation fault      "$DIR/daml/daml" install "$DIR" $@
FAILED TO INSTALL!
# exit

Attempt 2 with eclipse-temurin:11

ashokraj@ashokrajwhx5j3 ~ % docker run -it --entrypoint sh eclipse-temurin:11

Unable to find image 'eclipse-temurin:11' locally

11: Pulling from library/eclipse-temurin

Digest: sha256:e41c0ff25711398daa22288822866e51818707431edd6e515752951b7dd2dcad

Status: Downloaded newer image for eclipse-temurin:11

# curl -sSL https://get.daml.com/ | sh

Determining latest SDK version...

Latest SDK version is 2.2.0

Downloading SDK 2.2.0. This may take a while.

######################################################################## 100.0%

Extracting SDK release tarball.

/tmp/tmp.h21YjZqR4F/sdk/install.sh: line 5: 34 Segmentation fault "$DIR/daml/daml" install "$DIR" $@

FAILED TO INSTALL!

Am i doing something wrong here? What is the solution?

Note: Chip is Apple M1 pro and Docker is the one for Mac with apple chip.

Couple of possibilities here. Daml SDK with VS Code integration is most likely failing as there are amd64 binaries in the SDK for IDE integration. Almost certain that Docker does not handle virtualization within a Docker images.

Try using the --platform linux/amd64 flag to docker run as suggested here Run x86 (Intel) and ARM based images on Apple Silicon (M1) Macs? - Docker Desktop for Mac - Docker Community Forums

Following @sormeter dvice, I added this env variable to make sure the platform is always linux/amd64
export DOCKER_DEFAULT_PLATFORM=linux/amd64
and my docker compose has two nodes - one for canton and another for SDK.
The SDK one is still throwing the segmentation fault.
Here is my docker compose

version: '3'

services:
  connect.node:
    image: digitalasset/canton-open-source:latest
    ports:
      - "4011:10011"
      - "4012:10012"
    tty: true # map output to terminal
    environment:
      - CANTON_ALLOCATE_PARTIES=alice;bob
      - CANTON_CONNECT_DOMAINS=mydomain#http://localhost:10018
    command: ["daemon", 
      "-c" , "${CANTON_CONFIG:-config/participant.conf,config/domain.conf}",
      "--bootstrap=config/bootstrap.canton"]
    volumes:
      - ./config:/canton/config

  connect.navigator:
    # This image works ok
    image: digitalasset/daml-sdk:2.1.1
    # Navigator will not load the parties with this image
    # image: digitalasset/daml-sdk:2.1.0-snapshot.20220325.9626.0.4a483381
    # This command works with the snapshot but not the 2.0.0 release
    # command: sh -c "daml ledger navigator --host connect.node --port 10011 --port 4000"
    # We have to use this command with the 2.0.0 release but even then the navigator will not show the parties
    command: sh -c "daml navigator server connect.node 10011"
    ports:
      - "4000:4000"
    depends_on:
      - connect.node
    links:
      - connect.node

And here is the error am getting

 ⠿ Container simplestdeployment-connect.node-1       Recreated                                                                                                                                                                                       0.1s
 ⠿ Container simplestdeployment-connect.navigator-1  Recreated                                                                                                                                                                                       0.1s
Attaching to simplestdeployment-connect.navigator-1, simplestdeployment-connect.node-1
simplestdeployment-connect.navigator-1  | Segmentation fault
simplestdeployment-connect.navigator-1 exited with code 139

I’m a bit confused by this last message. It seems to say things work with 2.1.1, but not prior versions. Is that the case? If so, what is preventing you from using 2.1.1 (or better yet, 2.2.0)?

I’m also on Apple M1 and running into the same error (FAILED TO INSTALL!) when trying to install the SDK. Were you able to get past this error?

Housekeeping note. The answer to the post by @stephenwsun is available on this thread.