Dgraph now works with Docker Desktop on Apple Silicon

Just thought I’d drop a note here that I was able to get Dgraph to run on the new Docker for Desktop on Apple Silicon. I guess things started working on the recent release (Docker Desktop for Apple silicon | Docker Documentation)

When starting Dgraph, with the default command, you’ll get a warning that Dgraph does not launch for the specified arch, but the image still starts.

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

However, this can be suppressed by passing --platform linux/amd64 into docker run.

Of course, it would be nice to be able to get rid of this warning as well:

/run.sh: line 16: dgraph-ratel: command not found

Looking forward to having an arm optimised image someday

4 Likes

Hello @gja, can u pleae help me out how to run the dgraph locally. Below is my local dgraph configuration file:

zero:
    image: dgraph/dgraph:v21.03.1
    volumes:
      - data:/var/lib/dgraph-local/data:/dgraph
    ports:
      - 5080:5080
      - 6080:6080
    restart: on-failure
    command: dgraph zero --my=zero:5080
  alpha:
    image: dgraph/dgraph:v21.03.1
    volumes:
      -  data:/var/lib/dgraph-local/data:/dgraph
    ports:
      - 8080:8080
      - 9080:9080
    restart: on-failure
    command: dgraph alpha --my=alpha:7080 --zero=zero:5080 --security whitelist=172.20.0.1
  ratel:
    image: dgraph/dgraph:latest
    volumes:
      - type: volume
        source: pcc-dgraph
        target: /pcc-dgraph
        volume:
          nocopy: true
    ports:
      - 8000:8000
    command: dgraph-ratel
  db:
    image: arm64v8/postgres
    restart: on-failure
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_HOST=${POSTGRES_HOST}
      - POSTGRES_PORT=${POSTGRES_PORT}
      - POSTGRES_NAME=${POSTGRES_NAME}
    ports:
      - 5432:5432
    volumes:
      - data:/var/lib/postgresql/data
  pcc-server:
    build:
      context: ./
      dockerfile: ./cmd/pcc-server/Dockerfile
      args:
        GOOS: linux
        GOARCH: arm64
    environment:
      - DGRAPH_HEALTH_URL=${DGRAPH_HEALTH_URL}
      - DGRAPH_URL=${DGRAPH_URL}
      - PCC_ENV=${PCC_ENV}
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_HOST=${POSTGRES_HOST}
      - POSTGRES_PORT=${POSTGRES_PORT}
      - POSTGRES_NAME=${POSTGRES_NAME}
    ports:
      - 9999:9999
    command: ./pcc-go
    depends_on:
      - db
      - alpha
      - zero
      - ratel
volumes:
  data:
  pcc-dgraph:

Whenever I run this compose file, I get error:

Cannot start service ratel: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "dgraph-ratel": executable file not found in $PATH: unknown

Ratel is not available in the latest dgraph image anymore.
Use dgraph/ratel instead.
Alternatively use the older dgraph tag - dgraph/dgraph:v20.11.3

1 Like

Or you can just go to https://play.dgraph.io and point it at localhost

I thought there were issues with connecting to self hosted systems from play.dgraph.com, because dev environments are mostly setup without https and so chrome won’t connect.

But worth a shot!

It’s what I’ve been using the whole time. Haven’t run into issues yet.

1 Like

Thank you! I’ve gotten stuck with the tutorial and this command

docker run --rm -it -p 8000:8000 -p 8080:8080 -p 9080:9080 dgraph/standalone:v21.12.0

But thank to you, I updated the command to

docker run --rm -it -p 8000:8000 -p 8080:8080 -p 9080:9080 dgraph/standalone:v20.11.3

now I have dgraph UI at my localhost:8000. Really appreciate it!

1 Like