How to start dgraph stack locally using compose

Hi, I am trying to start dgraph with docker compose, as shown in the provided compose file from the docs, but it’s not working properly. Somehow the services seem to use localhost instead of the configured hostname.

zero_1    | E1017 14:12:02.495738       1 pool.go:311] CONN: Unable to connect with localhost:7080 : rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp 127.0.0.1:7080: connect: connection refused"
alpha_1   | I1017 14:12:02.701377       1 pool.go:164] CONN: Connecting to localhost:5080
alpha_1   | E1017 14:12:04.201835       1 groups.go:1181] Error during SubscribeForUpdates for prefix "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15dgraph.graphql.schema\x00": Unable to find any servers for group: 1. closer err: <nil>
version: "3.9"

services:
  zero:
    image: dgraph/dgraph
    volumes:
      - dgraph:/dgraph
    ports:
      - 5080:5080
      - 6080:6080
    command: dgraph zero --my=zero:5080 --telemetry "sentry=false;"

  alpha:
    image: dgraph/dgraph
    volumes:
      - dgraph:/dgraph
    ports:
      - 8080:8080
      - 9080:9080
    command: dgraph alpha --my=alpha:7080 --zero=zero:5080 --telemetry "sentry=false;"
    environment:
      DGRAPH_ALPHA_GRAPHQL_LAMBDA_URL: "http://lambda:8686/graphql-worker"

  lambda:
    image: dgraph/dgraph-lambda
    ports:
      - 8686:8686
    environment:
      DGRAPH_URL: http://alpha:8080
    # volumes:
    #   - ./gql/script.js:/app/script/script.js:ro

  ratel:
    image: dgraph/ratel
    ports:
      - 8000:8000

volumes:
  dgraph: {}

On a sidenote, I don’t know how to configure ratel as it has no documentation at all on dockerhub.

Do a deep cleanup in your Docker env. Also, check any bound paths and clean them too. Check for any Dgraph volume and delete them.

Ratel won’t access the Alpha via http://alpha:8080 cuz this is an internal naming in Docker’s internal network. As Ratel runs in your browser, you will have to use localhost or the IP of the VM if Docker is running in a VM.

Cheers.

I guess it was the volume from the previous try where there was the standalone container in use. Removing the volume has resolved the issue.

1 Like