0

I have private ethereum running node on my OSX at http://localhost:8545 From the OSX I can connect to this node

In [1]:         from web3 import Web3
   ...:         w3 = Web3(Web3.HTTPProvider('http://localhost:8545'))
   ...:         w3.isConnected()
   ...:
Out[1]: True

Then I run my docker container with the same command by using special DNS name host.docker.internal


In [2]:         from web3 import Web3
   ...:         w3 = Web3(Web3.HTTPProvider('http://host.docker.internal:8545'))
   ...:         w3.isConnected()
   ...:
Out[2]: False
version: '3'
services:
  jenkins:
    network_mode: host

network_mode: host does support only Linux

~/.docker/daemon.json. I have different default address pools because of local DNS.

{
    "experimental":true,
    "features":{
        "buildkit":true
    },
    "builder":{
        "gc":{
            "defaultKeepStorage":"20GB",
            "enabled":true
        }
    },
  "default-address-pools":
  [
    {"base":"10.10.0.0/16","size":24}
  ]
}

Question:
How to connect OSX host port from docker container?

joe
  • 8,383
  • 13
  • 61
  • 109

0 Answers0