Search code examples
dockerblockchaindocker-machinedocker-registry

Not able to access a tezos node ( in Docker ) from host machine in MacOS


Getting "Curl Error 52 Empty reply from server" while trying to access node processes running inside a docker container. The ports are getting exposing and mapped properly. And http-server request is being redirected to the host machine.

But when trying the same to get access RPC request that is giving error as: "Curl Error 52 Empty reply from server". (P.S. - The above issue is for Mac OS X)

Docker Version : 2.3.0.0 (44472) Channel: Edge Engine: 19.03.8

Running a Tezos Node inside Docker

Port we are trying to access from the host is 18731:

docker port <container_name>

gives :

18733/tcp -> 0.0.0.0:18733
18731/tcp -> 0.0.0.0:18731
18732/tcp -> 0.0.0.0:18732

Docker Inspect results :

[
{
    "Id": "9cad4bc213857e3e3f12c65119d8afdbe39035c7bbba571492d70a96ce314bdf",
    "Created": "2020-04-28T09:01:46.5606351Z",
    "Path": "/bin/bash",
    "Args": [],
    "State": {
        "Status": "running",
        "Running": true,
        "Paused": false,
        "Restarting": false,
        "OOMKilled": false,
        "Dead": false,
        "Pid": 4841,
        "ExitCode": 0,
        "Error": "",
        "StartedAt": "2020-04-28T14:43:15.27769Z",
        "FinishedAt": "2020-04-28T09:06:44.4686297Z"
    },
    "Image": "sha256:42099ae8fd65e7526e96a6eeb79617ae71d657bce777ac5c9d61428f8b1edb04",
    "ResolvConfPath": "/var/lib/docker/containers/9cad4bc213857e3e3f12c65119d8afdbe39035c7bbba571492d70a96ce314bdf/resolv.conf",
    "HostnamePath": "/var/lib/docker/containers/9cad4bc213857e3e3f12c65119d8afdbe39035c7bbba571492d70a96ce314bdf/hostname",
    "HostsPath": "/var/lib/docker/containers/9cad4bc213857e3e3f12c65119d8afdbe39035c7bbba571492d70a96ce314bdf/hosts",
    "LogPath": "/var/lib/docker/containers/9cad4bc213857e3e3f12c65119d8afdbe39035c7bbba571492d70a96ce314bdf/9cad4bc213857e3e3f12c65119d8afd
    "Name": "/mystifying_haslett",
    "RestartCount": 0,
    "Driver": "overlay2",
    "Platform": "linux",
    "MountLabel": "",
    "ProcessLabel": "",
    "AppArmorProfile": "",
    "ExecIDs": null,
    "HostConfig": {
        "Binds": null,
        "ContainerIDFile": "",
        "LogConfig": {
            "Type": "json-file",
            "Config": {}
        },
        "NetworkMode": "default",
        "PortBindings": {
            "18731/tcp": [
                {
                    "HostIp": "",
                    "HostPort": "18731"
                }
            ],
            "18732/tcp": [
                {
                    "HostIp": "",
                    "HostPort": "18732"
                }
            ],
            "18733/tcp": [
                {
                    "HostIp": "",
                    "HostPort": "18733"
                }
            ]
        },
        "RestartPolicy": {
            "Name": "no",
            "MaximumRetryCount": 0
        },
        "AutoRemove": false,
        "VolumeDriver": "",
        "VolumesFrom": null,
        "CapAdd": null,
        "CapDrop": null,
        "Capabilities": null,
        "Dns": [],
        "DnsOptions": [],
        "DnsSearch": [],
        "ExtraHosts": null,
        "GroupAdd": null,
        "IpcMode": "private",
        "Cgroup": "",
        "Links": null,
        "OomScoreAdj": 0,
        "PidMode": "",
        "Privileged": false,
        "PublishAllPorts": false,
        "ReadonlyRootfs": false,
        "SecurityOpt": null,
        "UTSMode": "",
        "UsernsMode": "",
        "ShmSize": 67108864,
        "Runtime": "runc",
        "ConsoleSize": [
            0,
            0
        ],
        "Isolation": "",
        "CpuShares": 0,
        "Memory": 0,
        "NanoCpus": 0,
        "CgroupParent": "",
        "BlkioWeight": 0,
        "BlkioWeightDevice": [],
        "BlkioDeviceReadBps": null,
        "BlkioDeviceWriteBps": null,
        "BlkioDeviceReadIOps": null,
        "BlkioDeviceWriteIOps": null,
        "CpuPeriod": 0,
        "CpuQuota": 0,
        "CpuRealtimePeriod": 0,
        "CpuRealtimeRuntime": 0,
        "CpusetCpus": "",
        "CpusetMems": "",
        "Devices": [],
        "DeviceCgroupRules": null,
        "DeviceRequests": null,
        "KernelMemory": 0,
        "KernelMemoryTCP": 0,
        "MemoryReservation": 0,
        "MemorySwap": 0,
        "MemorySwappiness": null,
        "OomKillDisable": false,
        "PidsLimit": null,
        "Ulimits": null,
        "CpuCount": 0,
        "CpuPercent": 0,
        "IOMaximumIOps": 0,
        "IOMaximumBandwidth": 0,
        "MaskedPaths": [
            "/proc/asound",
            "/proc/acpi",
            "/proc/kcore",
            "/proc/keys",
            "/proc/latency_stats",
            "/proc/timer_list",
            "/proc/timer_stats",
            "/proc/sched_debug",
            "/proc/scsi",
            "/sys/firmware"
        ],
        "ReadonlyPaths": [
            "/proc/bus",
            "/proc/fs",
            "/proc/irq",
            "/proc/sys",
            "/proc/sysrq-trigger"
        ]
    },
    "GraphDriver": {
        "Data": {
            "LowerDir": "/var/lib/docker/overlay2/5a75a97bc8b37a753b13c2a7e7f128fb723f55ae53ea2eee73994cdc383deba5-init/diff:/var/lib/docke
            "MergedDir": "/var/lib/docker/overlay2/5a75a97bc8b37a753b13c2a7e7f128fb723f55ae53ea2eee73994cdc383deba5/merged",
            "UpperDir": "/var/lib/docker/overlay2/5a75a97bc8b37a753b13c2a7e7f128fb723f55ae53ea2eee73994cdc383deba5/diff",
            "WorkDir": "/var/lib/docker/overlay2/5a75a97bc8b37a753b13c2a7e7f128fb723f55ae53ea2eee73994cdc383deba5/work"
        },
        "Name": "overlay2"
    },
    "Mounts": [],
    "Config": {
        "Hostname": "9cad4bc21385",
        "Domainname": "",
        "User": "",
        "AttachStdin": false,
        "AttachStdout": false,
        "AttachStderr": false,
        "ExposedPorts": {
            "18731/tcp": {},
            "18732/tcp": {},
            "18733/tcp": {}
        },
        "Tty": true,
        "OpenStdin": true,
        "StdinOnce": false,
        "Env": [
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
        ],
        "Cmd": [
            "/bin/bash"
        ],
        "Image": "tezsureinc/tezster:1.0.2",
        "Volumes": null,
        "WorkingDir": "",
        "Entrypoint": null,
        "OnBuild": null,
        "Labels": {}
    },
    "NetworkSettings": {
        "Bridge": "",
        "SandboxID": "5a1dd0e82d96429d960f9e6c71493b399e2c4bbf7efb65feb7c70f02a04d2adb",
        "HairpinMode": false,
        "LinkLocalIPv6Address": "",
        "LinkLocalIPv6PrefixLen": 0,
        "Ports": {
            "18731/tcp": [
                {
                    "HostIp": "0.0.0.0",
                    "HostPort": "18731"
                }
            ],
            "18732/tcp": [
                {
                    "HostIp": "0.0.0.0",
                    "HostPort": "18732"
                }
            ],
            "18733/tcp": [
                {
                    "HostIp": "0.0.0.0",
                    "HostPort": "18733"
                }
            ]
        },
        "SandboxKey": "/var/run/docker/netns/5a1dd0e82d96",
        "SecondaryIPAddresses": null,
        "SecondaryIPv6Addresses": null,
        "EndpointID": "132040e6a80291f2965b6aa5cc45f9237c210469e747dec73446e86951b4759c",
        "Gateway": "172.17.0.1",
        "GlobalIPv6Address": "",
        "GlobalIPv6PrefixLen": 0,
        "IPAddress": "172.17.0.2",
        "IPPrefixLen": 16,
        "IPv6Gateway": "",
        "MacAddress": "02:42:ac:11:00:02",
        "Networks": {
            "bridge": {
                "IPAMConfig": null,
                "Links": null,
                "Aliases": null,
                "NetworkID": "23456a611a031437e11780b4f58a0d1881906b4ce981647996966cee74aa6e5f",
                "EndpointID": "132040e6a80291f2965b6aa5cc45f9237c210469e747dec73446e86951b4759c",
                "Gateway": "172.17.0.1",
                "IPAddress": "172.17.0.2",
                "IPPrefixLen": 16,
                "IPv6Gateway": "",
                "GlobalIPv6Address": "",
                "GlobalIPv6PrefixLen": 0,
                "MacAddress": "02:42:ac:11:00:02",
                "DriverOpts": null
            }
        }
    }
}
]

How it is different from accessing a web-server running in docker Vs running an RPC based network?


Solution

  • There are two IPs inside the container, and its probably not listening on the 172.x.x.x IP. You must avoid using 127.0.0.1 or localhost anywhere inside docker container or while mapping ports. Instead using 0.0.0.0 will solve this issue. Hope this will help you out.