dgraph docker compose whitelist ip

When using https://github.com/dgraph-io/dgraph/blob/master/contrib/config/docker/docker-compose.yml file. I found an error

 curl -X POST localhost:8080/admin/schema --data-binary '@schema.graphql'
{"errors":[{"message":"resolving updateGQLSchema failed because unauthorized ip address: 172.23.0.1 (Locations: [{Line: 3, Column: 4}])","extensions":{"code":"Error"}}]}⏎

Apparently I need to whitelist my host ip address. --whitelist on alpha.

dgraph alpha --my=alpha:7080 --zero=zero:5080 --whitelist="0.0.0.0/0"

This is the full docker-compose file

# This Docker Compose file can be used to quickly bootup Dgraph Zero
# and Alpha in different Docker containers.

# It mounts /tmp/data on the host machine to /dgraph within the
# container. You can change /tmp/data to a more appropriate location.
# Run `docker-compose up` to start Dgraph.

version: "3.2"
services:
  zero:
    image: dgraph/dgraph:latest
    volumes:
      - /tmp/data:/dgraph
    ports:
      - 5080:5080
      - 6080:6080
    restart: on-failure
    command: dgraph zero --my=zero:5080
  alpha:
    image: dgraph/dgraph:latest
    volumes:
      - /tmp/data:/dgraph
    ports:
      - 8080:8080
      - 9080:9080
    restart: on-failure
    command: dgraph alpha --my=alpha:7080 --zero=zero:5080 --whitelist="0.0.0.0/0"
  ratel:
    image: dgraph/dgraph:latest
    ports:
      - 8000:8000
    command: dgraph-ratel

Last updated