podman-stop(1)

πŸ’… podman-stop(1) β€” stop one or more running containers

Okay bestie, this is the podman-stop(1) page from the General Commands Manual β€” yes, that's the manual name, I'm folding it in up top like a lil name tag πŸŽ€ β€” and honestly? It's giving "shut it down, respectfully." Let's go. ✨


🌸 NAME 🌸

podman-stop β€” stop one or more running containers. That's it. That's the whole job. Iconic. πŸ’…


✨ SYNOPSIS ✨

podman stop [options] container ...

podman container stop [options] container ...

Both forms slay equally β€” pick whichever vibe you want. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

So basically: this stops one or more containers, and you feed it container IDs or names as input. Easy.

The --time option is the ✨patience setting✨ β€” it's the number of seconds to wait before forcibly stopping the container after the stop command is issued to the container. Default is 10 seconds. Clock's ticking, babe. ⏳

By default, containers get stopped with SIGTERM and then SIGKILL after the timeout β€” so it's a polite ask first, then the not-so-polite ask. 😭

Fun fact: that SIGTERM default can be overridden by the image used to create the container, and also via command line when creating the container. So it's not always necessarily SIGTERM, iykyk. πŸ”₯


πŸ’– OPTIONS πŸ’–

  • --all, -a β€” Stop all running containers. Lowkey important: this does not include paused containers. πŸ™ˆ
  • *--cidfile=file* β€” Read the container ID from the specified file and stop the container. Can be specified multiple times. πŸ’« Command does not fail when the file is missing and the user specified --ignore.
  • --filter, -f=filter β€” Filter what containers stop. Multiple filters can be given with multiple uses of the --filter flag. Filters with the same key work inclusive, with the only exception being label, which is exclusive. Filters with different keys always work exclusive. No cap. 🧚

Valid filters are listed below:

  • id β€” [ID] Container's ID (CID prefix match by default; accepts regex)
  • name β€” [Name] Container's name (accepts regex)
  • annotation β€” [Key] or [Key=Value] Annotation assigned to a container
  • annotation! β€” [Key] or [Key=Value] Annotation NOT assigned to a container
  • label β€” [Key] or [Key=Value] Label assigned to a container
  • label! β€” [Key] or [Key=Value] Label NOT assigned to a container
  • exited β€” [Int] Container's exit code
  • status β€” [Status] Container's status: 'created', 'initialized', 'running', 'stopped', 'paused', 'exited', 'removing', 'stopping', 'unknown'
  • ancestor β€” [ImageName] Image or descendant used to create container (accepts regex)
  • before β€” [ID] or [Name] Containers created before this container
  • since β€” [ID] or [Name] Containers created since this container
  • volume β€” [VolumeName] or [MountpointDestination] Volume mounted in container
  • health β€” [Status] healthy or unhealthy
  • pod β€” [Pod] name or full or partial ID of pod
  • network β€” [Network] name or full ID of network
  • restart-policy β€” [Policy] Container's restart policy (e.g., 'no', 'on-failure', 'always', 'unless-stopped')
  • until β€” [DateTime] Containers created before the given duration or time.
  • command β€” [Command] the command the container is executing, only argv[0] is taken
  • should-start-on-boot β€” [Bool] Containers that need to be restarted after system reboot. True for containers with restart policy 'always', or 'unless-stopped' that were not explicitly stopped by the user
  • --ignore, -i β€” Ignore errors when specified containers are not in the container store. Picture this: a user decided to manually remove a container, which leads to a failure during the ExecStop directive of a systemd service referencing that container. This flag is literally the "it's fine, we move" button. 🫢
  • --latest, -l β€” Instead of providing the container name or ID, use the last created container. ⚠️ Note: the last started container can be from other users of Podman on the host machine, so like… mind the vibe check there. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines)
  • --time, -t=seconds β€” Seconds to wait before forcibly stopping the container. Use -1 for infinite wait β€” yes, infinite. Patience of a saint, bestie. πŸ•°οΈ
Heads up: --latest is genuinely unavailable on the remote Podman client, including Mac and Windows (excluding WSL2) machines. Not me gatekeeping, that's just the manpage. πŸ’€

πŸŽ€ EXAMPLES πŸŽ€

Stop the specified container via its name.

$ podman stop mywebserver

Stop the container via its id.

$ podman stop 860a4b235279

Stop multiple containers.

$ podman stop mywebserver 860a4b235279

Stop the container identified in the cidfile.

$ podman stop --cidfile /home/user/cidfile-1

Stop the containers identified in the cidfiles.

$ podman stop --cidfile /home/user/cidfile-1 --cidfile ./cidfile-2

Stop the specified container in 2 seconds.

$ podman stop --time 2 860a4b235279

Stop all running containers.

$ podman stop -a

Stop the last created container (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines)

$ podman stop --latest

Stop by label.

$ podman stop --filter label=app=frontend
9351ccb3ef4272532bc0c188bd4f0ddfc2b0de217732cd108259ea126b014647

Stop by name.

$ podman stop --filter name=db-replica
6c2680da61d54690718ac3aecdb04a8aad95ae353e42cc942736823bd05c8a1d

Stop by role label.

$ podman stop --filter label=role=primary
bb3ff91d969a8dc622d627e4a8d76c18bdbd417d317c5e7e66543c0b0c8ed1e8

πŸ‘‘ SEE ALSO πŸ‘‘

podman(1), podman-rm(1) β€” go read those too, bestie, they're literally right there. πŸ“š


🌈 HISTORY 🌈

September 2018, Originally compiled by Brent Baude bbaude@redhat.com ⟨mailto:bbaude@redhat.com⟩ β€” shoutout to the original author, we love a legend. πŸ’œ


And that's the whole page, bestie β€” go forth and stop things gently (or with -1 and infinite patience, your call). Signing off from podman-stop(1) in the General Commands Manual, same source, same 2018-era energy, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from