0

I have docker-composer setup: Php and Geth. I can ping from php docker container to geth cont. but I cant get response from it. If I hard code ip address of this geth container, I get response if I use "non-container" but inside php container no response.

root@vps:/root/docker# docker exec  908 ping **ether**

PING ether (172.24.0.5): 56 data bytes 
64 bytes from 172.24.0.5: seq=0  ttl=64 time=0.120 ms 
64 bytes from 172.24.0.5: seq=1 ttl=64 time=0.141 ms

but if I try to reach geth from this docker :

root@vps:/root/docker# docker exec  908   curl -X POST  -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":67}' http://**ether**:8545

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    83  100    23  100    60   3833  10000 --:--:-- --:--:-- --:--:-- 13833
**invalid host specified**

I confirm geth server is working since if I try

root@vps:/root/docker# curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' http://**172.24.0.5**:8545

I got response

{"jsonrpc":"2.0","id":67,"result":"Geth/v1.9.13-unstable-d3c1e654-20200326/linux-amd64/go1.13.9"}

My docker-compose

php:
    build:
      context: ./build/phpfpm
    links:
      - db
ether:
    image: ethereum/client-go
    ports:
      - 8545:8454
      - 30303:30303
    volumes:
      - ./data/ether:/root
    entrypoint:  geth --syncmode "light" --cache=256 --rpc --rpcaddr '0.0.0.0' --verbosity 1

My goal to acccess from php to geth .

1
  • shoud i restart php docker? I dont think because it pings, but i can access from it using ip address of geth docker – nerkn Mar 27 '20 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.