Need help with Ping: Bad Address error

I am new to docker/container. I noticed that my container cannot ping local FQDN at all. My containers are using the default/bridge network. I am using busybox image for this troubleshooting right now.

In container.
Ping FQDN results
Ping: Bad Address “FQDN”

Ping IP results: success.

NSLOOKUP FQDN result
Server: 127.0.0.11
Address: 127.0.0.11:53
Non-authoritative answer:
Name: FQDN
Address: 10.0.xx.xx

On the docker host. I have no issue resolving internal DNS or ping via FQDN or IP.

Can someone help me with this?

Could depend on the fqdn. If the container says bad address, I assume it is a special fqdn which is not accepted by the ping command in the busybox container. Try an ubuntu container, or nicolaka/nethsoot, or share how you installed Docker Exctly.

Docker is installed using the newest instruction from the docker website for ubuntu 24.
I tested on the ubuntu container with the same behavior. It is just a simple docker run -it ubuntu.
The /etc/resolv.conf in both the docker host and the container has search mytopleveld.domain in there. Maybe somehow that is related?

The resolv.conf is copied from your host (/run/systemd/resolv/resolv.conf) unless you are using a custom docker network which is also created by docker compose.

You added the docker-compose tag to the topic, but you don’t mention compose in your post… On the other hand, you write you just use a simple docker run command using ubuntu, but ubuntu has no ping command by default, unless you install it first. So is there any other detail missing from the instructions to reproduce the issue?

Since my last post, I realized that ping in a busybox container returns bad address when the domain is not resolvable, but ubuntu returns a different error since the ping package is different too. So please, don’t leave out any detail so we can figure out what the issue is exactly.

Please, share a link. There are multiple instructions for different kind of Docker variants.

Also please, share the output of the following command

dpkg -l | grep docker

And when you do so, use code blocks for the output: How to format your forum posts

Here is more info.
Docker installation using apt in this link:

dpkg -l | grep docker result

ii  docker-ce                              5:27.3.1-1~ubuntu.24.04~noble           amd64        Docker: the open-source application container engine
ii  docker-ce-cli                          5:27.3.1-1~ubuntu.24.04~noble           amd64        Docker CLI: the open-source application container engine
ii  docker-ce-rootless-extras              5:27.3.1-1~ubuntu.24.04~noble           amd64        Rootless support for Docker.
ii  docker-compose                         1.29.2-6ubuntu1                         all          define and run multi-container Docker applications with YAML
ii  docker-compose-plugin                  2.29.7-1~ubuntu.24.04~noble             amd64        Docker Compose (V2) plugin for the Docker CLI.
rc  docker.io                              24.0.7-0ubuntu4.1                       amd64        Linux container runtime
ii  python3-compose                        1.29.2-6ubuntu1                         all          Python implementation of docker-compose file specification
ii  python3-docker                         5.0.3-1ubuntu1.1                        all          Python 3 wrapper to access docker.io's control socket
ii  python3-dockerpty                      0.4.1-5                                 all          Pseudo-tty handler for docker Python client (Python 3.x)

And here is the other container using compose file.

services:
  homepage:
    image: ghcr.io/gethomepage/homepage:latest
    container_name: homepage
    ports:
      - 3000:3000
    volumes:
      - ./config:/app/config 
      - ./images:/app/public/images
      - ./icons:/app/public/icons
    env_file:
      - .env
    restart: 'unless-stopped'

None of my compose files use a custom network, they all default.
Also, almost all my containers use ghcr.io or lscr.io as the base image.

Please let me know if you need any other information. I appreciate your help.

Yep, those are user defined network with default values, which get created during deployment of a docker compose project. Containers attached to user defined networks use docker’s built-in dns server on 127.0.0.11 (like seen in your example), which uses the nameservers configured in /etc/resolv.conf as upstream servers.

We are talking about docker compose deployments, and not docker stack deploy deployments, right?

Correct. Just docker-compose. No stack.

Another thing I noticed. If I ping my top-level domain, my Domain Controller, it can resolve.

ping -4 works fine… but why it’s not using v4 when none of the interface or network has v6?

Can you share the output of docker network inspect <name of the network> ?

You could try to disable ipv6 specifically by adding those lines to your compose file:

networks:
  default:
    enable_ipv6: false

Make sure to run docker compose down before a docker compose up -d, in order to delete the existing network, so it can be recreated using the new configuration. Networks are immutable → they will not be updated in-place.

here is the output after adding the networks section.

[
    {
        "Name": "homepage_default",
        "Id": "e58e1967f79e4a32db5acde3119b4c861767f2a9e3e0e4be879c9f5be822bd2b",
        "Created": "2024-10-24T14:49:00.427797402Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.18.0.0/16",
                    "Gateway": "172.18.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": true,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "ddf3a558be7edb93564bb448cd51ad42457b137d40917751cc17faa1f3cb9442": {
                "Name": "homepage",
                "EndpointID": "824c04fa765aa38608158c94fdff058ed33f252ad38f396b061baf629dde2e9e",
                "MacAddress": "02:42:ac:12:00:02",
                "IPv4Address": "172.18.0.2/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "homepage",
            "com.docker.compose.version": "1.29.2"
        }
    }
]

As a note, I already disable IPv6 on the host and set the docker daemon to ipv6 false.

This shows you are still using docker-compose commands not docker compose. I have no idea if the old compose has anything to do with your issue (probably not, since the error happened without compose as well) , but you should definitely stop using an already discontinued compose version.

And if Docker was really

The docker-compose package should have been uninstalled as the very first command in the documentation includes uninstalling docker.io and also docker-compose among other packages.