Docker name resolv does not work

Hello everybody,

I would like to connect to a container from within an other container.

This is the startup of my container:

docker run -d -h 'gitlab.example.org' \
--net web \
-m 0b \
-p 2222:22 \
[...]
 --name gitlab-gitlab-ce --cidfile=/var/run/docker-gitlab-gitlab-ce.cid --restart="always" gitlab/gitlab-ce:latest

Unfortunately I can not resolve the hostname from other containers in the same network.

nslookup gitlab.example.org
nslookup: can't resolve '(null)': Name does not resolve

nslookup: can't resolve 'gitlab.example.org': Name does not resolve

Additional information - this is the result of docker inspect web

 docker inspect web
[
    {
        "Name": "web",
        "Id": "2e3a04df9de45396b4976435e057b7e32786fae7d9185a7e2248b6bffce17529",
        "Created": "2020-03-12T11:01:59.857151813Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.18.0.0/16",
                    "Gateway": "172.18.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "27eedb5ba4df979072450825c11fa2fe6e93115584f08cf5bc0cecbd80ef158a": {
                "Name": "gitlab-gitlab-ce",
                "EndpointID": "398b3bc205670eb74b32e1490d45a4ff25fd6d9863f98a47a05d1cf335cf6079",
                "MacAddress": "02:42:ac:12:00:03",
                "IPv4Address": "172.18.0.3/16",
                "IPv6Address": ""
            },
            "5bfd5b1fa40f6c12cd21d7340e4e9b281d31a492abf11892f0a3e4d7678554da": {
                "Name": "traefik-traefik",
                "EndpointID": "8f4853030d1cafe29ae8dbcf43d8562c0c4b8e9b636d25ac74579e46c5a7585c",
                "MacAddress": "02:42:ac:12:00:05",
                "IPv4Address": "172.18.0.5/16",
                "IPv6Address": ""
            },
            "7cd33ba505c00641278378ff2a9e8bf40baf83fd5259f046b4e5973421d1e34f": {
                "Name": "mariadb-mariadb",
                "EndpointID": "e46216ca4188dbb14dcf51cb74ee1fc1840359e5d7c50064bd28d9cb93d212d8",
                "MacAddress": "02:42:ac:12:00:04",
                "IPv4Address": "172.18.0.4/16",
                "IPv6Address": ""
            },
            "88d60b85874101deee0b0f6638ea99f32a7d7d06314ca2789bc2dc3be077e1a2": {
                "Name": "passbolt-passbolt",
                "EndpointID": "1b1d215c3ba2206614eaa7d3bf203ebfd074f90d00866d69a5de1a1f283ac867",
                "MacAddress": "02:42:ac:12:00:02",
                "IPv4Address": "172.18.0.2/16",
                "IPv6Address": ""
            },
            "c514d0dec00bf6c448325e2b61d7462cc46db1124393a6a629e4865f0eba4d9e": {
                "Name": "sensu-sensu",
                "EndpointID": "c4a7199665f3bc12ac68416575d218c763b0f7dcfe59e424f0e92fac7eecd672",
                "MacAddress": "02:42:ac:12:00:06",
                "IPv4Address": "172.18.0.6/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

Why would you expect the docker networks dns to act as the authorative dns server for example.org? It is the authority for a domain matching the network name, which also is the default search domain for the dns.

Please specify a hostname instead of a full quallified domain name.