Skip to content

Containers day to day

Stacks deploy the sets; this chapter is the daily handling of single containers — reading them, logging into their output, stopping and starting them, looking inside. Most of what a console is for happens here, in small acts done often.

Check: transcript portainer-lab/transcripts/t05-containers-day-to-day.txt follows the lab's cache through a stop and a start, its state flipping running → exited → running, each step asked through Portainer.

The list, and one container

The containers page is the engine's truth in a table: name, image, state, the stack it belongs to, ports. Click a name and the container gets a page of its own — its configuration as the engine sees it (inspect, in the engine's vocabulary), its mounts, network, labels, and the buttons the rest of this chapter walks through. Anything you meet here that surprises you is the engine's answer, not Portainer's opinion; the proxy (chapter 2) does not editorialize.

Logs

The logs page answers the first question of every bad day — what did it say last? — with the container's own output, timestamped, tail-first, and a live-follow mode for watching. The API equivalent is GET /endpoints/<id>/docker/containers/<id>/logs, and transcript t05 shows the web service's log holding exactly what it should: two requests the lab made, each answered 200, plus two startup complaints from the sandbox that the server shrugged off. (The transcript also shows the odd single characters that start some raw log lines — the engine's log-frame headers, which the web viewer quietly strips.)

Logs are the program's stdout and stderr, nothing more: a program that writes its diary to a file inside the container has nothing to show here, and chapter 14 counts that among the honest limits.

Stop, start, and their cousins

Stop asks the program to finish — a polite signal, then force after a grace period. Kill does not ask. Restart is stop and start with one click. Pause freezes a container mid-breath; it holds its memory and does nothing until unpaused. The lab stopped the practice cache through the API (HTTP 204, the engine's "done, nothing to show"), watched the list agree, then started it again — the smallest complete proof that the console's buttons are the engine's levers.

Inside: console, processes, stats

The console page attaches a shell inside a running container — if the image carries one; many production images are deliberately shell-less, and the page will simply fail to find /bin/sh. The lab did not drive the console (it is an interactive socket, and leaves no transcript), and the chapter teaches it as exactly that: present, useful, and to be opened in the awareness that you are now typing inside someone else's running program.

Processes (the engine's top) and stats — processor, memory, network, live — complete the page. Here the lab owes you a failure, kept verbatim in transcript t05: the sandbox's kernel refused the process listing outright (crun may not open the container's /proc there), and Portainer faithfully handed over the refusal. On an ordinary engine the same page returns the table. The lesson is the guide's recurring one: the console shows the engine's answers, including "no".

Recreating a container

Edit-and-redeploy exists at container level too: Recreate destroys the container and builds a fresh one from its recorded configuration (pulling the image again, if you ask it to). It is how a single container picks up a new image version without a stack — and it is destructive of everything in the container that was not in a volume, which is why volumes exist (next chapter).