Interview's MateDocker
Interview's Mate

Docker

Compose · Networking · Security · Ops

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Docker topics
Lesson 68/ 160
04. Docker Networking

None Networking Mode (--network none) for Air-Gapped Workloads

Run containers with no network stack for sandboxed or air-gapped jobs.

Intermediate--network none · Air-Gap3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Use none for preprocessing, converters or sandboxed jobs whose complete input and output travel through files or pipes.

Think of it like…

The workload is placed in a quiet room with the door removed and a document tray at the wall-data can enter only through the planned handoff.

Where you’ve seen it

In practice, docker run --rm --network none -v $(pwd)/in:/in:ro -v $(pwd)/out:/out alpine:3.21 sh -c "gzip -c /in/a.csv > /out/a.csv.gz" is the concrete move for this job: run containers with no network stack for sandboxed or air-gapped jobs. The release is not accepted until ip route inside the container should show no external route, while the host verifies the expected output file checksum confirms the result.

Words you’ll hear

--network none
The implementation control in docker run --rm --network none -v $(pwd)/in:/in:ro -v $(pwd)/out:/out alpine:3.21 sh -c "gzip -c /in/a.csv > /out/a.csv.gz" for run containers with no network stack for sandboxed or air-gapped jobs.
Air-Gap
The result to observe with ip route inside the container should show no external route, while the host verifies the expected output file checksum, rather than infer from a successful command alone.
Sandbox
The production boundary exposed when forgetting that a none container with a writable Docker socket or privileged host access is still not isolated from the machine.

Visual diagram

Loading interactive diagram

Theory & deep dive

--network none control path

The concrete mechanism is docker run --rm --network none -v $(pwd)/in:/in:ro -v $(pwd)/out:/out alpine:3.21 sh -c "gzip -c /in/a.csv > /out/a.csv.gz". The observable result is ip route inside the container should show no external route, while the host verifies the expected output file checksum; if those disagree, inspect the runtime evidence before changing unrelated settings.

Run containers with no network stack for sandboxed or air-gapped jobs. Keep --network none, Air-Gap and Sandbox in the same deployment record so the intent and the observed state cannot drift apart.

Concrete --network none setup

docker run --rm --network none -v $(pwd)/in:/in:ro -v $(pwd)/out:/out alpine:3.21 sh -c "gzip -c /in/a.csv > /out/a.csv.gz"

Key takeaway: Prove Air-Gap with ip route inside the container should show no external route, while the host verifies the expected output file checksum, not with command success alone.

Sandbox failure boundary

A service that silently retries DNS or downloads a model will hang rather than self-explain. “Air-gapped” still needs filesystem, CPU, host-kernel and volume controls; network mode is not a complete security sandbox. The narrow failure to design for is forgetting that a none container with a writable Docker socket or privileged host access is still not isolated from the machine.

Accept this compromise explicitly: No-network mode is a strong network boundary for bounded workloads; it blocks package installation, telemetry and secret retrieval at runtime. The controlled check-ip route inside the container should show no external route, while the host verifies the expected output file checksum-also identifies the point where a different design is safer.

Deliberate failure test

Exercise this failure safely: forgetting that a none container with a writable Docker socket or privileged host access is still not isolated from the machine.

Key takeaway: No-network mode is a strong network boundary for bounded workloads; it blocks package installation, telemetry and secret retrieval at runtime.

How it works, step by step

Step 1 of 4
Design

1. State the boundary

Write down why the workload needs this: A service that silently retries DNS or downloads a model will hang rather than self-explain. “Air-gapped” still needs filesystem, CPU, host-kernel and volume controls; network mode is not a complete security sandbox.

Use none for preprocessing, converters or sandboxed jobs whose complete input and output travel through files or pipes.
Key numbers at this step
Intent
--network none

When to use it & trade-offs

What it is

--network none gives a container its own otherwise empty network namespace with loopback only. It cannot resolve external DNS or connect out unless a new interface or namespace join is deliberately introduced.

Why it matters: A service that silently retries DNS or downloads a model will hang rather than self-explain. “Air-gapped” still needs filesystem, CPU, host-kernel and volume controls; network mode is not a complete security sandbox.

When to reach for it

  • The fit is strongest for this job: run containers with no network stack for sandboxed or air-gapped jobs. Pair it with ip route inside the container should show no external route, while the host verifies the expected output file checksum in the runbook.
  • Production --network none changes should make Air-Gap observable through docker run --rm --network none -v $(pwd)/in:/in:ro -v $(pwd)/out:/out alpine:3.21 sh -c "gzip -c /in/a.csv > /out/a.csv.gz", rather than trusting the runtime default.
  • Keep a rollback example for the case where forgetting that a none container with a writable Docker socket or privileged host access is still not isolated from the machine.

When to avoid or be careful

  • Do not accept command success while the system can still fail by forgetting that a none container with a writable Docker socket or privileged host access is still not isolated from the machine.
  • Avoid erasing Sandbox protection merely to dodge this cost: “No-network mode is a strong network boundary for bounded workloads; it blocks package installation, telemetry and secret retrieval at runtime”.
  • Do not replace the evidence path-ip route inside the container should show no external route, while the host verifies the expected output file checksum-with a screenshot or a mutable tag.

docker run --rm --network none -v $(pwd)/in:/in:ro -v $(pwd)/out:/out alpine:3.21 sh -c "gzip -c /in/a.csv > /out/a.csv.gz": practical choices

Explicit --network none
Best for: Run containers with no network stack for sandboxed or air-gapped jobs, with a reviewed runbook.

Strengths: --network none gives a container its own otherwise empty network namespace with loopback only. It cannot resolve external DNS or connect out unless a new interface or namespace join is deliberately introduced.

Watch out: No-network mode is a strong network boundary for bounded workloads; it blocks package installation, telemetry and secret retrieval at runtime.

Ambient default
Best for: Short-lived Air-Gap experiments with low blast radius.

Strengths: It can begin with docker run --rm --network none -v $(pwd)/in:/in:ro -v $(pwd)/out:/out alpine:3.21 sh -c "gzip -c /in/a.csv > /out/a.csv.gz" and fewer surrounding controls.

Watch out: It silently accepts forgetting that a none container with a writable Docker socket or privileged host access is still not isolated from the machine, which makes the result hard to reproduce after promotion.

Managed Sandbox
Best for: Teams that centralize Sandbox policy across many workloads.

Strengths: A service that silently retries DNS or downloads a model will hang rather than self-explain. “Air-gapped” still needs filesystem, CPU, host-kernel and volume controls; network mode is not a complete security sandbox.

Watch out: The platform adds an ownership and debugging layer; retain ip route inside the container should show no external route, while the host verifies the expected output file checksum as the direct check.

Interview signals & numbers to know

When this topic comes up

  • docker run --rm --network none -v $(pwd)/in:/in:ro -v $(pwd)/out:/out alpine:3.21 sh -c "gzip -c /in/a.csv > /out/a.csv.gz"
  • ip route inside the container should show no external route, while the host verifies the expected output file checksum
  • Failure signature: forgetting that a none container with a writable Docker socket or privileged host access is still not isolated from the machine
  • Trade-off: No-network mode is a strong network boundary for bounded workloads; it blocks package installation, telemetry and secret retrieval at runtime.

Benchmarks & rules of thumb

1 interface -
loopback is present
0 external routes -
under ordinary none mode
2 planned file handoffs -
read-only input and writable output mounts

Common mistakes & follow-ups

Common interview mistakes

  • Treating a successful docker run --rm --network none -v $(pwd)/in:/in:ro -v $(pwd)/out:/out alpine:3.21 sh -c "gzip -c /in/a.csv > /out/a.csv.gz" as proof and skipping ip route inside the container should show no external route, while the host verifies the expected output file checksum.
  • Forgetting that a none container with a writable Docker socket or privileged host access is still not isolated from the machine
  • Optimizing --network none without accepting that no-network mode is a strong network boundary for bounded workloads; it blocks package installation, telemetry and secret retrieval at runtime.

Likely interviewer follow-ups

  • Why does docker run --rm --network none -v $(pwd)/in:/in:ro -v $(pwd)/out:/out alpine:3.21 sh -c "gzip -c /in/a.csv > /out/a.csv.gz" address --network none here rather than through application code?
  • How would you distinguish healthy Air-Gap from the failure “forgetting that a none container with a writable Docker socket or privileged host access is still not isolated from the machine” using ip route inside the container should show no external route, while the host verifies the expected output file checksum?
  • When would this trade-off-“No-network mode is a strong network boundary for bounded workloads; it blocks package installation, telemetry and secret retrieval at runtime”-justify a different Sandbox design?
Interview tip: Give one concrete operation-docker run --rm --network none -v $(pwd)/in:/in:ro -v $(pwd)/out:/out alpine:3.21 sh -c "gzip -c /in/a.csv > /out/a.csv.gz"-and one proof-ip route inside the container should show no external route, while the host verifies the expected output file checksum. Then name the boundary: forgetting that a none container with a writable Docker socket or privileged host access is still not isolated from the machine.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply None Networking Mode (--network none) for Air-Gapped Workloads with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Host Networking Mode (--network host) & Performance Trade-offs
Next topic
Macvlan & IPvlan Drivers (Assigning Physical LAN IPs to Containers)