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 ( 56 data bytes 
64 bytes from seq=0  ttl=64 time=0.120 ms 
64 bytes from 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://****:8545

I got response


My docker-compose

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

My goal to acccess from php to geth .

  • 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.