Interview Q&A / Docker & Kubernetes

BeginnerQuick answer1 min readUpdated 3 Oct 2026

What is the difference between a named volume and a bind mount?

SHORT ANSWER

A named volume is storage created and managed by Docker, stored in its own area and portable between containers. A bind mount maps an exact host folder into the container, which suits live code editing but depends on the host layout.

Explain it simply

A named volume is a locker in the college's storage room: the staff handle where it is, you just remember the locker name. A bind mount is carrying your own bag and placing it on the desk: you know exactly where it sits on your side.

With -v pgdata:/var/lib/postgresql/data, Docker creates and manages pgdata; it survives container removal, works on any OS, and is the right choice for databases. With -v "$(pwd)":/app, your project folder appears inside the container, so editing code on your laptop instantly changes what the container sees. That is great for development with hot reload. Downsides of bind mounts: they depend on the host path existing, can have permission and performance issues on Docker Desktop, and give the container direct access to host files.

Example

bash
docker run -d -v pgdata:/var/lib/postgresql/data postgres:16   # named volume
docker run -d -v "$(pwd)":/app -w /app node:20 npm start       # bind mount
docker volume ls

What to say in the interview

"Named volumes are Docker-managed, portable and best for persistent data like databases. Bind mounts map a specific host path, best for development with live code reload but tied to the host layout."

Common mistakes

  • Bind-mounting node_modules from a different OS into the container.

#docker#volumes#storage

Related questions

Practise more Docker & Kubernetes questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Docker & Kubernetes quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.