graphprotocol / graph-node

Graph Node indexes data from blockchains such as Ethereum and serves it over GraphQL

Home Page:https://thegraph.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Run a local Graph Node on linux problem with host.docker.internal

Npizza opened this issue · comments

Do you want to request a feature or report a bug?
bug
What is the current behavior?
I am trying to set up localy graph node with docker and when I am trying to fix the host.docker.internal bug something is not going as expected.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

I am following the instructions on the https://thegraph.com/docs/quick-start .
First I Set up Ganache CLI then I am trying to run the Graph Node.
I Clone Graph Node, Enter the Graph Node's Docker directory and then I go to Note for Linux users:

There I type the command:
$ CONTAINER_ID=$(docker container ls | grep graph-node | cut -d' ' -f1)
and then the command:
$ docker exec $CONTAINER_ID /bin/bash -c 'ip route | awk \'/^default via /{print $3}\''

But the bash I think is waiting for me to complete the command.
So I look what the CONTAINER_ID variable has with echo and I found out that there is nothing there.
Then I type docker container ls to see what is the list of the containers and I found that is empty too.

What I am missing?

What is the expected behavior?
To print the host's IP

I found the solution to the problem.
It seems for some reason that
$ docker exec $CONTAINER_ID /bin/bash -c 'ip route | awk \'/^default via /{print $3}\''
has some syntax error and when you try to run it it waits for some input.
I found a work around this by doing this steps:
-I run the docker contrainer with docker-compose up ( If you want you can run it on the background with -d attribute)
-On a other terminal run $ CONTAINER_ID=$(docker container ls | grep graph-node | cut -d' ' -f1)
This way you have on the CONTAINER_ID the name of the container.
-Execute this command to have access to the terminal of the docker container docker exec -it $CONTAINER_ID bash
-And execute ip route | awk '/^default via /{print $3}' to take the IP that you wanted for the next step of the tutorial.

Cheers!