Skip to content
Blog

The Docker none Network Driver, In Depth

What --network none really gives a container: loopback only, a resolv.conf that exists but cannot be reached, no multi-network connect, and how it compares to internal networks.

Published on • November 19, 2026

AI Assistant

--network none sounds like a switch flipped off, and for traffic it is. But the fine print is where people get burned: the container still has a resolv.conf, it still reports a DNS server, and you still cannot bolt a network onto it later when you change your mind. The none driver is the most misunderstood network in Docker precisely because it’s the simplest — so here’s exactly what a none container does and doesn’t have, verified against Engine 29.7.2.

What’s actually in the namespace

docker run -d --name none1 --network none alpine sleep 3600
docker exec none1 ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host

One interface: lo. No eth0, no veth pair, no gateway, no routes. Outbound traffic fails immediately rather than timing out:

docker exec none1 ping -c 1 8.8.8.8
ping: sendto: Network unreachable

(The Docker docs state that no IPv6 loopback address is configured for none containers; on this host ::1 was present on lo. Kernel and Docker versions vary — verify in your container rather than trusting either claim.)

The resolv.conf trap

Here’s the detail that surprises everyone: a none container does have a /etc/resolv.conf, and it’s a copy of the host’s:

docker exec none1 cat /etc/resolv.conf
# Generated by Docker Engine
nameserver 192.168.65.7

There’s no 127.0.0.11 embedded DNS — that only exists for containers attached to a network Docker manages. What you have instead is a nameserver pointing at the host’s resolver, with no interface and no route to reach it. DNS fails with a network error, not a “server not found”:

docker exec none1 nslookup example.com
;; connection timed out; no servers could be reached
can't connect to remote host '192.168.65.7': Network unreachable

Two consequences: application code that treats “DNS failed” as retryable will spin against an unreachable resolver instead of failing fast, and seeing a nameserver in the config is not evidence of connectivity. A none container is offline even though its config looks normal.

You cannot add a network later

This is the verified behavior that contradicts the intuition “start with none, attach when needed”:

docker network connect bridge none1
Error response from daemon: container cannot be connected to multiple networks with one of the networks in private (none) mode

none is a private mode: a container running with it cannot be joined to any network while it’s in that state, and a container on another network can’t be moved onto none via connect either. Isolation is chosen at docker run time — if you need none for a batch job and networking later, you recreate the container. Plan for that in your Compose files and CI scripts.

Choosing your isolation level

none isn’t the only way to cut egress. A practical comparison:

ApproachEgressPeer DNSOutbound namesCan connect later?
--network noneNone (loopback only)NoneFails (unreachable resolver)No
--internal bridgeBlocked to outside; container-to-container OKEmbedded DNS worksFails (no default route)Yes
--internal + gateway_mode=isolatedSame, but the bridge has no host address at allEmbedded DNS worksFailsYes
Ordinary bridgeFull, masqueradedEmbedded DNS worksForwarded upstreamYes

The distinction that matters: --internal keeps conversations inside the network (containers talk to each other, nothing gets out), while none keeps a single container out of every conversation, including with its peers. gateway_mode=isolated goes one step further than plain --internal by removing the bridge’s host-facing address entirely — useful when the host itself must not be a neighbor. And if you want containers to talk and rely on host-level firewall policy for egress control, that’s a different design again: Docker’s own rules plus your chains, not driver-level isolation.

Compose and hardening

Declaring it in Compose is one line:

services:
  batch:
    image: my-batch:latest
    network_mode: none
    read_only: true
    cap_drop:
      - ALL

Because the container can’t reach anything, pair none with the restrictions that matter for untrusted or offline work: read_only, cap_drop: ALL, a non-root user, and explicit volume mounts for input/output. Classic uses are offline batch transforms over mounted data, key generation, and sandboxing user-submitted code — anywhere “no socket out” is a security requirement, not just a preference.

Debugging a none container

Three checks cover every report of “no network”:

  1. ip addr show — is it only lo? If there’s an eth0, you’re not on none.
  2. Is it DNS or the network? nslookup failing with Network unreachable to the nameserver address is the none signature — resolution never even left the container.
  3. Trying to network connect? The “private (none) mode” error means recreation, not misconfiguration.

One more habit worth building: treat none containers as hostile-input boundaries in your runbooks, not as a config detail. If a job is supposed to be air-gapped, assert it — a startup script that fails unless ip link shows only lo converts “we believe it’s isolated” into “it is isolated, or we hear about it immediately.”

The bottom line

--network none gives a container loopback and nothing else: no eth0, no route, an outbound-unreachable resolv.conf copied from the host, and a refusal to join any network afterwards. It’s the strongest driver-level isolation Docker offers — which makes it the right default for sandboxed code and offline jobs, and the wrong one for anything you might want to reach later. Choose it deliberately at run time, because Docker won’t let you change your mind in place.

Further reading