Skip to content

Keeping Portainer

Portainer is software too: it has versions, it needs updating, and its memory deserves a backup like any other small, irreplaceable thing. This chapter does the backup for real — out of a running console, into one encrypted file, and back into a fresh install that signs in with the accounts the backup carried.

Check: transcript portainer-lab/transcripts/t10-restore.txt — a wiped console, restored, listing both of the lab's users, with the practice stack's record back in its list.

Updating the console

Portainer updates the way the things it manages do: the container is disposable, the volume is the console. The procedure, stated once, plainly:

  1. Pull the new image (docker pull portainer/portainer-ce:latest, or the new exact tag).
  2. Stop and remove the Portainer container. Its volume is untouched by this, and so is every container it managed — the engines neither know nor care that the console is briefly down.
  3. Run the new image with the same socket and the same data volume, the chapter 3 command unchanged.

It starts against its existing database, migrates what needs migrating, and your users, environments and stacks are simply there. The lab did not perform an update — it installed the current release (2.45.3) fresh, and an update to the same version is no update at all — so this procedure is taught from the project's documentation and marked as such in criteria.md. Take the backup below before any real one.

The backup

Settings → (the backup section) offers a download: one file, which is the data volume's contents, sealed. A password is asked for, and Portainer encrypts the archive with it — the lab's download arrived named portainer-backup_....tar.gz.encrypted, 14,751 bytes, and tar could make nothing of it at all (transcript portainer-lab/transcripts/t08-backup.txt, whose note reads the "failure" correctly: it is the feature). Keep the file somewhere that is not the machine it backs up, and the password somewhere that is not the file's name.

The archive carries everything: users and their hashes, environments, permissions, stacks, settings. It is, in one small file, the whole of chapter 2's memory — and therefore a privileged object in its own right. Encryption is not decoration on it; it is what makes a stolen copy merely embarrassing instead of fatal.

The restore

On a fresh Portainer — no administrator yet — the setup screen offers Restore beside the first-login form, and the API route the lab took (POST /api/restore) asks for the same thing the setup does: this instance's setup token (chapter 4's lock guards restoration too, and rightly — a restore is a claiming of the console), the archive file, and the backup's password.

Transcript t10 is the whole story: a fresh instance, the restore accepted, and then the ordinary login door opening to the old credentials — admin as before, reader back in the users list, the storybook stack record restored. One honest wrinkle the transcript keeps: the restore returned the stack's record, but its containers had been removed from the engine before the restore, so the record pointed at work that no longer existed. A backup restores Portainer's memory. The world outside went on without it, and the chapter on limits counts that gap among the permanent ones.