Skip to content

Volumes and networks

Containers are disposable; two things are built to outlast them. Volumes hold data that must survive the container. Networks decide who can talk to whom. This chapter covers the console's pages for both, and the one surprise every new Portainer user meets: the volume still standing after its stack is gone.

Check: transcript portainer-lab/transcripts/t09-remove-stack.txt shows the lab's stack deleted, its containers gone — and storybook_story-data still listed, calm as you like, in the volumes.

Volumes: the deliberate memory

A named volume is a folder the engine keeps in its own territory, mounted into containers at a path the image expects (/data, for the practice cache). The volumes page lists each with its driver (almost always local), its mountpoint on the host, and the containers using it. Chapter 6's stack made one; chapter 7's container operations never threatened it; chapter 9's point is its temperament:

  • Removing a container loses only the container. Its volumes stay.
  • Removing a stack removes its containers and network. Its volumes stay — transcript t09 is the proof, and it is a design decision, not an oversight: data should require a deliberate executioner.
  • Removing a volume is that deliberate act: Volumes → select → Remove, refused while a container still uses it. Do it when you mean the data gone, because it is.

Two honest notes about the page. It cannot browse a volume's contents in the Community Edition — the list is an inventory, not a file manager; to see inside, mount the volume into a throwaway container. And a volume's safety is the host's safety: Portainer will faithfully list the volume of a backup you never made, chapter 12's subject, on the drive that is about to fail.

Anonymous volumes — the unnamed ones images sometimes claim for their scratch space — accumulate quietly; the list's "unused" filter finds them, and the same deliberateness applies.

Networks: who can reach whom

The networks page lists the engine's networks with their driver and scope. The ones that matter daily:

  • bridge — the default private network. Containers on it reach each other; the outside world reaches a container only through a published port (chapter 6's 8080:80). Every stack gets a bridge network of its own when Compose builds it, named for the stack, so one stack's services find each other by service name and cannot wander into another stack's kitchen.
  • host — no network of its own: the container shares the machine's. Fast, and it gives up all isolation; a service on host networking hears every port the machine hears. The lab's stack ran this way because its sandbox allows nothing else (transcript t90), and on a normal engine you would choose it rarely and on purpose.
  • none — a container with only a loopback, for work that must not talk at all.

Creating networks by hand — custom subnets, an internal network with no route out, overlay networks for Swarm — is the page's advanced end, described here rather than run, and governed by one rule: a network is a trust decision wearing a plumbing costume. Containers that share one can reach each other, in full, by name. Put things that should not meet on different networks, and let published ports be the only bridges.