Gerrit container using Container ID as a hostname. "Could not resolve host: 7c7d0ce1769d"

91 views
Skip to first unread message

Charles Forry

unread,
Nov 16, 2023, 7:11:54 PM11/16/23
to Repo and Gerrit Discussion
# http://cos-docker-01:8081/
# Container name: dkr-gerrit-1 "Could not resolve host: 7c7d0ce1769d"

# In my gerrit repository, "Clone with commit-msg hook" fails on my Windows development laptop with a DNS issue because the hostname is the CONTAINER ID.

C:\Users\cforry\>git clone "http://admin@7c7d0ce1769d/a/Repo1" && (cd "Repo1" && mkdir -p .git/hooks && curl -Lo `git rev-parse --git-dir`/hooks/commit-msg http://admin@7c7d0ce1769d/tools/hooks/commit-msg; chmod +x `git rev-parse --git-dir`/hooks/commit-msg)
Cloning into 'Repo1'...
fatal: unable to access 'http://7c7d0ce1769d/a/Repo1/': Could not resolve host: 7c7d0ce1769d


# docker ps output for the container:
CONTAINER ID   IMAGE                       COMMAND          CREATED        STATUS     PORTS
7c7d0ce1769d   gerritcodereview/gerrit    "/entrypoint.sh"  2 months ago   Up 4 weeks 0.0.0.0:29418->29418/tcp, :::29418->29418/tcp, 0.0.0.0:8081->8080/tcp, :::8081->8080/tcp   ddn-gerrit-1

# docker inspect shows it connected to ddn-container-network and ddn_default:
"Networks": {
                "ddn-container-network": {
                    "IPAMConfig": {},
                    "Links": null,
                    "Aliases": [
                        "7c7d0ce1769d"
                    ],
                    "NetworkID": "568a53fcb7a76e90659817687b24b059598944f42d0f3426226e4265fdb6e299",
                    "EndpointID": "7da88baaf2f101db04ab2a779bc94b6e0ffe805e590c3e22737b6692ce46f144",
                    "Gateway": "172.20.0.1",
                    "IPAddress": "172.20.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:14:00:02",
                    "DriverOpts": {}
                },
                "ddn_default": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": [
                        "dkr-gerrit-1",
                        "gerrit",
                        "7c7d0ce1769d"
                    ],
                    "NetworkID": "eb41d1ddfcb88fe97e79ebceffcb4ac5c3ae0522f7f563d63283f974c44c0100",
                    "EndpointID": "9969350a411e5ef4dfc28c32004ca51140f6f456971d35aed4d150ff994e3506",
                    "Gateway": "172.24.0.1",
                    "IPAddress": "172.24.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:18:00:02",
                    "DriverOpts": null
                }
            }



# docker network
# I see these docker networks and the two, dkr-gerrit-1 and ddn_default, that gerrit is connected to is shown but I am not sure why neither one of them is internet aware?

ddn@cos-docker-01:~$ docker network ls
NETWORK ID     NAME                    DRIVER    SCOPE
ab6750d1527e   bridge                  bridge    local
568a53fcb7a7   ddn-container-network   bridge    local
eb41d1ddfcb8   ddn_default             bridge    local
d0eb62c8bb61   host                    host      local
4952eb326396   mysqlnet                bridge    local
0c20175efcc9   netbox-docker_default   bridge    local
072eeab8845f   none                    null      local


# docker inspect of ddn-container-network.
ddn@cos-docker-01:~$ docker inspect 568a53fcb7a7
[
    {
        "Name": "ddn-container-network",
        "Id": "568a53fcb7a76e90659817687b24b059598944f42d0f3426226e4265fdb6e299",
        "Created": "2023-03-22T16:35:40.777700234-06:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.20.0.0/16",
                    "Gateway": "172.20.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "7c7d0ce1769d828a6fb669e490cc54bc1bd48166980ea07b1b0e09d6a105baaa": {
                "Name": "dkr-gerrit-1",
                "EndpointID": "7da88baaf2f101db04ab2a779bc94b6e0ffe805e590c3e22737b6692ce46f144",
                "MacAddress": "02:42:ac:14:00:02",
                "IPv4Address": "172.20.0.2/16",
                "IPv6Address": ""
            },
            "c81567f79c14017d410cb4f348d87a2ccff9c80399e0b228b37f87d90f146b01": {
                "Name": "dkr-jenkins-1",
                "EndpointID": "2f67a4e50cc67215d88fd8ae85c8c08aae50205fac24c34d402591125411c16d",
                "MacAddress": "02:42:ac:14:00:03",
                "IPv4Address": "172.20.0.3/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]
ddn@cos-docker-01:~$

# docker inspect of ddn_default
ddn@cos-docker-01:~$ docker inspect eb41d1ddfcb8
[
    {
        "Name": "ddn_default",
        "Id": "eb41d1ddfcb88fe97e79ebceffcb4ac5c3ae0522f7f563d63283f974c44c0100",
        "Created": "2023-08-28T15:39:43.041736742-06:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.24.0.0/16",
                    "Gateway": "172.24.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "7c7d0ce1769d828a6fb669e490cc54bc1bd48166980ea07b1b0e09d6a105baaa": {
                "Name": "dkr-gerrit-1",
                "EndpointID": "9969350a411e5ef4dfc28c32004ca51140f6f456971d35aed4d150ff994e3506",
                "MacAddress": "02:42:ac:18:00:02",
                "IPv4Address": "172.24.0.2/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "ddn",
            "com.docker.compose.version": "2.20.3"
        }
    }
]
ddn@cos-docker-01:~$




# Docker inspect of bridge network
ddn@cos-docker-01:~$ docker inspect ab6750d1527e
[
    {
        "Name": "bridge",
        "Id": "ab6750d1527ea4a8d483495cb1be3ff8b0b3d8c8d5e3aefa3176d9bfee50aac0",
        "Created": "2023-10-17T18:14:29.728169595-06:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.17.0.0/16",
                    "Gateway": "172.17.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "1106cfb91aea7f5465cecc143ab42fdfe131cf6ab7162e375258f8a0408ee47a": {
                "Name": "registry",
                "EndpointID": "bfa20c1f0841320855deba81546f5d571b4c126789d9c1989910dc5e8e930b50",
                "MacAddress": "02:42:ac:11:00:04",
                "IPv4Address": "172.17.0.4/16",
                "IPv6Address": ""
            },
            "89f2f75d0e342e0dce89032132f3886b1acbfbf1e568b41fc35b7844d857aa86": {
                "Name": "docker-agent-alpine-000l12rd133w1",
                "EndpointID": "41c96745f7f62e2832d66c72cb45eb8417c54d59dcdc86aa993a896b04993fc7",
                "MacAddress": "02:42:ac:11:00:02",
                "IPv4Address": "172.17.0.2/16",
                "IPv6Address": ""
            },
            "a85b3a03030db67dfda533d17dee25810995acd012bcc672b1a0f3a7b163b155": {
                "Name": "analyzer",
                "EndpointID": "0db6b0142ead0bb92f54633c751c95edbb4e7960b3a0f3f95552da92b3533b73",
                "MacAddress": "02:42:ac:11:00:03",
                "IPv4Address": "172.17.0.3/16",
                "IPv6Address": ""
            }
        },
        "Options": {
            "com.docker.network.bridge.default_bridge": "true",
            "com.docker.network.bridge.enable_icc": "true",
            "com.docker.network.bridge.enable_ip_masquerade": "true",
            "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
            "com.docker.network.bridge.name": "docker0",
            "com.docker.network.driver.mtu": "1500"
        },
        "Labels": {}
    }
]
ddn@cos-docker-01:~$


# I would like the ddn-container-network to be internet aware but not sure how to set it up so all containers connected to the ddn-container-network can see the internet.
# I would assume the gateway (10.36.16.1) needs set on the ddn-container-network somehow and that the containers attached would need some tweaking as well but not sure how to do that either.
# Also, these containers are /16 while my physical network is /20 so I'm not sure how that plays into this.
 Thanks for any assistance.
Chuck Forry

Aaron Smith

unread,
Nov 17, 2023, 11:38:46 AM11/17/23
to Repo and Gerrit Discussion
Is that container ID anywhere in your gerrit config? I've seen this value inserted automatically into the gerrit config -- changing it to the actual hostname fixed it.

Fabio Ponciroli

unread,
Nov 17, 2023, 11:50:13 AM11/17/23
to Aaron Smith, Repo and Gerrit Discussion
Hi,


On Fri, 17 Nov 2023 at 17:38, 'Aaron Smith' via Repo and Gerrit Discussion <repo-d...@googlegroups.com> wrote:
Is that container ID anywhere in your gerrit config? I've seen this value inserted automatically into the gerrit config -- changing it to the actual hostname fixed it.


The container ID comes from the default $HOSTNAME variable used to populate the canonicalWebUrl [1]
HTH,
Ponch

P.S.: Please avoid top posting on this list, instead use interleaved posting style [2] which is easier to follow a conversation

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/90056feb-1d4e-4602-84ea-5b5fc7b59544n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages