The moving parts
Portainer has fewer parts than it appears to. By the end of this chapter you can name each one, say where it lives, and predict which part holds a given fact — the skill that turns later confusion into a named problem.
Check: after reading, you should be able to answer three questions without looking. Where does Portainer keep its users? What does it ask when you click "stop"? And what is left of Portainer if its data volume is deleted? (The answers end the chapter.)
The server
Portainer itself is one program,
running as one container, listening on
two ports: 9443 for its web
interface over HTTPS with a certificate
it makes itself, and 9000 for the
same interface over plain HTTP — plus
its API, which lives under the same
ports at /api. The pages you click
and the API this guide's lab drove are
two faces of the same server; anything
the UI can do, the API can do, because
the UI is doing it through the API.
The data volume: its whole memory
The server keeps everything it knows
in one folder, /data inside its
container, which the install maps to a
volume on the host (chapter 3):
- The database: users and their password hashes, teams, environments, who may access what, settings.
- The stack projects: when you
deploy a stack, its Compose file is
filed under
/data/compose/, one folder per stack — transcript t04 shows the lab's at/data/compose/1. - Its TLS keys, and the rest of its small state.
Delete the volume and Portainer starts over as a stranger: no users, no environments, no stacks — while every container on the engine keeps running, unmanaged but unharmed. Protect the volume and you have protected the console; chapter 12's backup is just that folder, sealed and encrypted.
Environments and endpoints
An environment (older versions and the API say endpoint — the words are interchangeable, and transcripts in this guide use both) is one engine Portainer looks after. It is a small record: a name, a kind, and an address to reach the engine's API:
- A socket on the same machine — the local engine, chapter 5's case.
- A TCP address, for an engine that exposes its API over the network (with TLS, one hopes, and chapter 14 explains why the hope matters).
- An agent: a small companion program, the Portainer Agent, running on a remote machine and speaking for its engine.
- An Edge agent, for machines that cannot be reached inbound and must phone home instead.
One Portainer, many environments: the
lab has exactly one (local, id 1),
and everything the lab does names it.
The engine, and the proxy
Portainer does no container work
itself. For every action it calls the
environment's engine through the
engine's API, and it also forwards
that API: a call to
/api/endpoints/1/docker/containers/json
is Portainer passing your request to
engine 1 and handing you the answer —
transcript t03 shows it returning the
engine's own version. This proxy is
why the lab could verify so much
without a browser: the API is not a
back door. It is the front door, and
the pages walk through it too.
Answers to the check
Users live in the database, in the data volume. Clicking "stop" makes Portainer call the engine's API for that environment and ask it to stop the container. And if the data volume is deleted, nothing is left of Portainer at all — except its container, ready to be set up by whoever arrives first. Chapter 4 is about that arrival.