infrastructure//Docker//lifecycle
A container's lifecycle is set by the flags it is started with: whether it survives its own exit, and whether it holds the terminal or runs in the background. Persistent nodes use `-d` without `--rm`; tooling uses `--rm` without `-d`.
A container's lifecycle is set by the flags it is started with: whether it survives its own exit, and whether it holds the terminal or runs in the background. Persistent nodes use -d without --rm; tooling uses --rm without -d.
--rm creates ephemeral use-and-discard containers, suited to one-shot tools such as key generation; the Besu Docker path runs all its Besu tooling this way. The key generation pattern runs, saves its output and self-destructs:
Copy
docker run --rm -v $(pwd):/data besu ... export-address
-d (detach) runs the container in the background and returns control to the terminal.
-it (interactive plus tty) attaches the terminal to the container, the opposite of -d.