You already have the container’s IP address and the service port, but the connection from the Linux server fails. Before touching the firewall or restarting Docker, check where the path stops: service, network namespace, bridge, route, or local filtering.
The procedure below applies to Docker Engine running rootful, installed directly on the same Linux host from which you run the commands. Docker Desktop, rootless mode, and a remote daemon do not follow exactly the same path.

If you have not yet identified the address, start with the guide to identifying the container’s IP and network. Here, we assume you already know the IP. A bridge address is not necessarily reachable from the physical machine with Docker Desktop or from the host outside the RootlessKit namespace.
Confirm that you are on the engine host
A Docker client can control a remote daemon. In that case, the container’s internal IP belongs to the daemon’s machine, not necessarily the one where you type curl.
docker context show
docker version --format '{{.Server.Version}}'
docker info --format '{{json .SecurityOptions}}'
These commands display the current context, the server version, and the security options. They do not necessarily reveal the full effective target if Docker environment variables are involved. Confirm that the daemon is local without copying variables or endpoint URLs that might contain credentials into a ticket. Do not switch contexts to “try it out”: you could end up inspecting a different engine.
Docker Desktop runs Engine in a lightweight Linux virtual machine. On Linux Desktop, a bridge address in that VM is not automatically reachable from the host system. In that case, check the ports that are already published with docker port, and test the existing published target rather than looking for docker0 on the physical machine.
In rootless mode, the IP shown by docker inspect is in RootlessKit’s network namespace. Docker documents that this address is not directly accessible from the host outside that namespace. Do not try to bypass this isolation using the rootful Engine steps below.
Check the service status and listening socket
Replace CONTENEUR with the name or ID you already know. The following command makes no changes:
docker inspect --type=container --format '{{.Name}} etat={{.State.Status}} running={{.State.Running}} pid={{.State.Pid}} mode={{.HostConfig.NetworkMode}}' CONTENEUR
If the container is stopped or restarting, the route will not help yet. Check a limited window of logs:
docker logs --timestamps --since 10m --tail 50 CONTENEUR
Sometimes the logs contain nothing, especially if the logging driver does not expose them or the program does not write to stdout/stderr. They may also contain sensitive data. For a service managed by Compose, the dedicated guide explains how to read Docker Compose service logs.
A container marked running does not guarantee that its application is listening. With a local rootful Engine, retrieve its PID and check it before entering its network namespace:
PID=$(docker inspect --type=container --format '{{.State.Pid}}' CONTENEUR)
printf 'PID=%s\n' "$PID"
Continue only if the result is an integer strictly greater than zero and the container is still running. If the container has been recreated in the meantime, check its status and PID again. Never use nsenter with PID 0.
sudo nsenter --target "$PID" --net ss -lnt
nsenter --net runs ss in the process’s network namespace, without opening a shell or changing the configuration. The PID belongs to the container’s main process; its network namespace provides access to the view of that container’s sockets. Running ss directly on the host shows the host’s sockets, not those in that namespace.
Look for the internal TCP port you already know. A listener on 127.0.0.1:PORT or [::1]:PORT is limited to the container’s loopback interface. A listener on the container’s address or 0.0.0.0:PORT can accept a connection to that IPv4 address. [::]:PORT alone does not prove that the application also accepts IPv4; that depends on its dual-stack configuration. The absence of a socket on the expected port points to the process, port, or protocol. This check covers TCP, not UDP. If ss is missing or access is denied, note this limitation; do not install anything in the container being diagnosed.
Test the internal IP and published port separately
Use a known read-only URL on an endpoint that does not trigger an action. Do not test a webhook or command URL. The request below bypasses the proxy for this call only, with short timeouts:
curl --noproxy '*' --connect-timeout 3 --max-time 5 --silent --show-error --output /dev/null --write-out 'HTTP %{http_code}\n' 'http://IP_CONTENEUR:PORT_INTERNE/ENDPOINT_LECTURE'
Replace the values with the IP and port already identified, then use a read-only path that is actually documented for your service. Do not use 0.0.0.0 or :: as the destination address. For HTTPS, keep the hostname required by the certificate; -k does not fix a network problem.
An HTTP code, including 401, 403, or 404, shows that a service or intermediary responded. 000 is curl’s value when it has not received an HTTP code; it is not a server status. An immediate refusal may indicate that nothing is listening or that an active rejection occurred. A timeout may be caused by a route, filtering, or a service that is not responding. None of these results identifies the cause on its own.
If a port is already published, compare it separately:
docker port CONTENEUR
curl --noproxy '*' --connect-timeout 3 --max-time 5 --silent --show-error --output /dev/null --write-out 'HTTP %{http_code}\n' 'http://ADRESSE_HOTE:PORT_PUBLIE/ENDPOINT_LECTURE'
Use an actual host address and the published port shown. This comparison does not require creating a port publication. A response through the published port and a failure on the internal IP do not automatically prove which rule is involved; they simply narrow down what needs to be examined.
Read the bridge and the selected route
Identify the network to which the container is attached, then check its configuration:
docker network inspect --format 'nom={{.Name}} pilote={{.Driver}} interne={{.Internal}} ipam={{json .IPAM.Config}} options={{json .Options}}' RESEAU
ip -br link
ip -br addr
ip route get IP_CONTENEUR
This procedure targets a network whose driver is bridge. A custom bridge is not necessarily docker0; identify the interface that is actually present and cross-check it against the addresses and route. Do not invent an interface name based on the network ID.
ip route get shows the local routing decision, including the selected interface and source address. Output through a VPN or an unexpected interface is an indicator to document, not an instruction to change routes. If needed, you can supplement the observation with ip rule show and ip route show table all. To understand this command’s output, see the guide explaining how to check the route Linux actually selects.
A route pointing to the bridge does not prove that the service accepts the connection. An incomplete neighbor state can help locate the problem, but the table may be empty if there has been no recent traffic. Traffic generated locally by a program on the host does not automatically pass through the FORWARD chain like a packet forwarded from the LAN.
Examine filtering without disabling it
Docker installs its own filtering and isolation rules for its networks. Check the available state without changing it:
sudo nft list ruleset
sudo iptables -S
sudo iptables -t nat -S
Also use the tool for the firewall that is actually present, if you use one: sudo ufw status verbose or firewall-cmd --get-active-zones. A rejected command, a missing chain, or empty output does not prove that filtering is absent. iptables may be a front end to nftables, so two outputs do not necessarily mean there are two independent firewalls.
Follow the local path and its return path. Do not draw conclusions based on DOCKER-USER or FORWARD alone: they do not automatically describe a connection initiated by the host to the bridge address. The value of sysctl net.ipv4.ip_forward does not by itself diagnose this local traffic and does not justify changing it. Docker’s documentation describes the filtering rules and warns against altering the rules it manages.
Do not use nft flush ruleset, iptables -F, a global ACCEPT policy, ufw disable, or a firewall or Docker restart for testing. Do not add a rule or change a route or VPN during this diagnosis. A change could cut off other access, including SSH, without addressing the cause.
Decide where to stop
- Container stopped or restarting: focus on its status and logs.
- No socket on the internal port: check the application process, port, and listening address.
- Docker Desktop or rootless: do not apply the rootful Engine route; check existing port publications and the limitations of the network mode.
- Selected route is outside the expected bridge: save the output and have the routing handled as a separate operation.
- Listener and route look correct, but the request times out: filtering and the return path still need to be examined; do not claim a definite cause based on the timeout alone.
- HTTP response: the transport reached a service or intermediary; continue at the HTTP or application level.
This guide does not change any settings or create any containers. A route, firewall, or application configuration change should be handled as a separate intervention, with its own scope and precautions.
Technical sources: Docker Engine: bridge network driver; Docker Engine: packet filtering and firewalls; Docker Desktop: networking; Docker Engine: rootless troubleshooting. To distinguish an HTTP code from a transport error, also see the LinuxEnCaja guide to interpreting curl’s output.