Live load docker local failing

I am trying to set up a a local devt evt (with the intention of using dgraph cloud) for production. I want to be able to seed/reseed my local env with fixture data.

Following the documenation on exporting an importing, i used this command:

docker run -it --rm -v <local-path-to-data>:/tmp dgraph/dgraph:latest \
  dgraph live --alpha <Dgraph Alpha gRPC endpoint> -f /tmp/<data-file> -s /tmp/<schema-file>

The docs say --alpha should be localhost:9080 by default. But it fails to connect. I also tried the IP i got from

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dgraph-local

but that fails too.

This is the error I get:

Running transaction with dgraph endpoint: 172.20.10.15:9080
While trying to setup connection: context deadline exceeded. Retrying...
2023/04/23 02:03:39 Could not setup connection after 1 retries
github.com/dgraph-io/dgraph/x.Fatalf

If anyone knows a fix let me know. Or another approach for seeding/reseeding with fixture data.

Thx

Feels like these commands are wrong. Or you are not sharing the whole thing. Assuming you are doing the right thing.

You are running the liveloader within a container. This container has its own network context and is generally isolated from other containers. In order to execute “localhost” from within a container, the container would need to be exposed to the host. This is one solution for your case. This is because the localhost within the container is pointing to itself, its own network context. Therefore, this command will not work. Another solution, instead of exposing the container to the host, is to attach it to the Dgraph’s cluster network. You need to find out which network Docker created or define the network the cluster should run on. You can do this with either docker-compose or docker run. You can determine the network by name and even set a fixed internal IP address in the docker compose.

Your problem is purely related to Docker usage.

Thanks, I was using a ‘learning environment’ Learning Environment - Deploy with the ’ Launch a Dgraph standalone cluster using Docker’ setup and was trying to export fixture data that I had set up manually in dgraph cloud and import it to that env.

Perhaps that’s not the best approach for what I want to do - which is have a local devt environment that I can auto-reset at every launch so I have consistent seed/fixture data for devt and testing.