Live loader not working in docker

Hello, I’m new to dgraph and want to get familiar with loading large amounts of data into running instances. My experimental environment are these three dockers:

version: "3.2"
services:
  zero:
    image: dgraph/dgraph:latest
    volumes:
      - /dgraph/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 --lru_mb=2048 --zero=zero:5080
  ratel:
    image: dgraph/dgraph:latest
    ports:
      - 8000:8000
    command: dgraph-ratel

Now when all containers are running, in zero container:

root@518619f4252d:/dgraph# dgraph live -f test.json -s schema
[Decoder]: Using assembly version of decoder
I0203 16:21:03.847464      37 init.go:98] 

Dgraph version   : v1.2.0
Dgraph SHA-256   : 62e8eccb534b1ff072d4a516ee64f56b7601e3aeccb0b2f9156b0a8e4a1f8a12
Commit SHA-1     : 24b4b7439
Commit timestamp : 2020-01-27 15:53:31 -0800
Branch           : HEAD
Go version       : go1.13.5

For Dgraph official documentation, visit https://docs.dgraph.io.
For discussions about Dgraph     , visit http://discuss.dgraph.io.
To say hi to the community       , visit https://dgraph.slack.com.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2018 Dgraph Labs, Inc.



Running transaction with dgraph endpoint: 127.0.0.1:9080
While trying to setup connection: context deadline exceeded. Retrying...
2020/02/03 16:21:14 Could not setup connection after 1 retries
github.com/dgraph-io/dgraph/x.Fatalf
	/tmp/go/src/github.com/dgraph-io/dgraph/x/error.go:101
github.com/dgraph-io/dgraph/x.GetDgraphClient
	/tmp/go/src/github.com/dgraph-io/dgraph/x/x.go:731
github.com/dgraph-io/dgraph/dgraph/cmd/live.run
	/tmp/go/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:398
github.com/dgraph-io/dgraph/dgraph/cmd/live.init.0.func1
	/tmp/go/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:117
github.com/spf13/cobra.(*Command).execute
	/tmp/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830
github.com/spf13/cobra.(*Command).ExecuteC
	/tmp/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914
github.com/spf13/cobra.(*Command).Execute
	/tmp/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
github.com/dgraph-io/dgraph/dgraph/cmd.Execute
	/tmp/go/src/github.com/dgraph-io/dgraph/dgraph/cmd/root.go:69
main.main
	/tmp/go/src/github.com/dgraph-io/dgraph/dgraph/main.go:73
runtime.main
	/usr/local/go/src/runtime/proc.go:203
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1357

Is this error due to some network isolation among containers, or what may be the problem here?

What type of Docker installation are you running? Native? Virtual Machine? Cloud?
By default Dgraph points to Localhost. So, when this error happens is because of the docker-machine inst available in localhost.

You should add the addr using -a flag.

dgraph live -f test.json -s schema -a cloudOrHostIPAddr:9080

It is native docker installation. Localhost is correct, when running docker ps, here is output:

CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                                                                NAMES
4a35b757d7e7        dgraph/dgraph:latest   "dgraph zero --my=12…"   25 seconds ago      Up 23 seconds       0.0.0.0:5080->5080/tcp, 8080/tcp, 0.0.0.0:6080->6080/tcp, 9080/tcp   zero_1
e6c6a94998df        dgraph/dgraph:latest   "dgraph alpha --my=1…"   25 seconds ago      Up 23 seconds       0.0.0.0:8080->8080/tcp, 0.0.0.0:9080->9080/tcp                       alpha_1
ffe5134cf8ab        dgraph/dgraph:latest   "dgraph-ratel"           3 days ago          Up 24 seconds       8080/tcp, 0.0.0.0:8000->8000/tcp, 9080/tcp                           ratel_1

also on host machine all the open ports look ok:

ss -tlpn
State     Recv-Q    Send-Q       Local Address:Port         Peer Address:Port                                         
LISTEN    0         128                      *:8080                    *:*                                            
LISTEN    0         128                      *:9080                    *:*                                            
LISTEN    0         128                      *:5080                    *:*                                            
LISTEN    0         128                      *:6080                    *:*                                            
LISTEN    0         128                      *:8000                    *:*

Are you able to access Ratel?

http://localhost:8000

I’m sorry, didn’t realize docker compose creates a separate network in which containers are accessible using their service names and not 127.0.0.1. In this case the solution is to simply run

dgraph live -f test.json -s schema -a alpha:9080

Thank you

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.