We’re overhauling Dgraph’s docs to make them clearer and more approachable. If you notice any issues during this transition or have suggestions, please let us know.

To learn about Dgraph and the components, you can install and run Dgraph cluster on a single host using Docker, Docker Compose, or Dgraph command line.

Dgraph cluster can be setup running as containers on a single host.

Before you begin

Ensure that you have installed:

Launch a Dgraph standalone cluster using Docker

  1. Select a name <CONTAINER_NAME> for you Docker container and create a directory <GRAPH_DATA_PATH> that for Dgraph data on your local file system.

  2. Run a container with the dgraph/standalone image:

       docker run --name <CONTAINER_NAME> -d -p "8080:8080" -p "9080:9080" -v <DGRAPH_DATA_PATH>:/dgraph dgraph/standalone:latest
    
  3. Optionally launch Ratel using the dgraph/ratel docker image:

    docker run --name ratel  -d -p "8000:8000"  dgraph/ratel:latest
    

    You can now use Ratel UI on your browser at localhost:8000 and connect to you Dgraph cluster at localhost:8080

Setup a Dgraph cluster on a single host using Docker

  1. Get the <IP_ADDRESS> of the host using:

       ip addr  # On Arch Linux
       ifconfig # On Ubuntu/Mac
    
  2. Pull the latest Dgraph image using docker:

       docker pull dgraph/dgraph:latest
    
  3. Verify that the image is downloaded:

       docker images
    
  4. Create a <DGRAPH_NETWORK> using:

       docker network create <DGRAPH_NETWORK>
    
  5. Create a directory <ZERO_DATA>to store data for Dgraph Zero and run the container:

    mkdir ~/<ZERO> # Or any other directory where data should be stored.
    
    docker run -it -p 5080:5080 --network <DGRAPH_NETWORK> -p 6080:6080 -v ~/<ZERO_DATA>:/dgraph dgraph/dgraph:latest dgraph zero --my=<IP_ADDRESS>:5080
    
  6. Create a directory <ALPHA_DATA_1> to store for Dgraph Alpha and run the container:

    mkdir ~/<ALPHA_DATA_1> # Or any other directory where data should be stored.
    
    docker run -it -p 7080:7080 --network <DGRAPH_NETWORK> -p 8080:8080 -p 9080:9080 -v ~/<ALPHA_DATA_1>:/dgraph dgraph/dgraph:latest dgraph alpha --zero=<IP_ADDRESS>:5080 --my=<IP_ADDRESS>:7080
    
  7. Create a directory <ALPHA_DATA_2> to store for the second Dgraph Alpha and run the container:

    mkdir ~/<ALPHA_DATA_2> # Or any other directory where data should be stored.
    
    docker run -it -p 7081:7081 --network <DGRAPH_NETWORK> -p 8081:8081 -p 9081:9081 -v ~/<ALPHA_DATA_2>:/dgraph dgraph/dgraph:latest dgraph alpha --zero=<IP_ADDRESS>:5080 --my=<IP_ADDRESS>:7081  -o=1
    

    To override the default ports for the second Alpha use -o.

  8. Connect the Dgraph cluster that are running using https://play.dgraph.io/. For information about connecting, see Ratel UI.