Gerrit container is using CONTAINER ID for a hostname? Need internet access to the Gerrit container

ISSUE:

dkr-gerrit-1 “Could not resolve host: 7c7d0ce1769d”

In my docker gerrit repository, “Clone with commit-msg hook” fails on my Windows development laptop

with a DNS issue because the hostname is the CONTAINER ID:

Cloning into ‘Repo1’…
fatal: unable to access ‘http://7c7d0ce1769d/a/Repo1/’: Could not resolve host: 7c7d0ce1769d

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

Not finding any docs that help.

Also, these containers are netmask /16 while my physical network is /20 so I’m not sure how

that plays into this.

Thanks for any assistance.

Chuck Forry

You have an issue with bold fonts? :wink:

Hehe - not sure why it came out like that that

Please format your first post according How to format your forum posts.

Your post makes excessive use of markdown headlines. Almost every line if formatted as headline.

Ok, I tried to delete to restart the post and see if I could get it to take a txt formatted input but it wont go away so lets start fresh from here.
problem:
On a gerrit container hosted by a server named cos-docker-01, “Clone with commit-msg hook” fails when I copy and paste into my Windows development laptop with a DNS issue because the hostname is the CONTAINER ID.

note the ‘hostname’ below is the container id so it’s unresolvable’. How do I fix that?
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 ://admin@7c7d0ce1769d/tools/hooks/commit-msg; chmod +x git rev-parse --git-dir/hooks/commit-msg)
Cloning into ‘Repo1’…
fatal: unable to access ‘://7c7d0ce1769d/a/Repo1/’: Could not resolve host: 7c7d0ce1769d

Thank you for posting it readable.

Though, I am afraid you will need to provide more context information that allows us to understand what you try to achieve and how you try to do it. We don’t know image is used and how the container is created (as in exact docker run command or compose file content).

docker run 7c7d0ce1769d --restart=on-failure -v gerrit_home:/mnt/p_data/gerrit
docker update --restart unless-stopped -v gerrit_home:/mnt/p_data/gerrit 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

I thought we established that you place 3 backticks in front and after code to make it readable (with correct spacing) and don’t write whole paragraphs in bold.

We are all community here :slightly_smiling_face:

Kind reminder. this is not limited to the first post.