Created
November 5, 2023 00:50
-
-
Save christopher-baek/39281e25f55d22d90026759cc0934b41 to your computer and use it in GitHub Desktop.
podman Cheat Sheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# podman Cheat Sheet | |
**create a pod** | |
``` | |
podman pod create --name=my-pod | |
``` | |
**create a container in a pod** | |
``` | |
podman create --pod=my-pod --name=container-a -t centos top | |
podman create --pod=my-pod --name=container-b -t centos top | |
``` | |
**generate systemd configurations** | |
``` | |
cd $HOME/.config/systemd/user | |
podman generate systemd --new --files --name my-pod | |
``` | |
**reload the daemon** | |
``` | |
systemctl --user daemon-reload | |
``` | |
**start the pod** | |
``` | |
systemctl --user start pod-my-pod.service | |
systemctl --user is-active pod-my-pod.service | |
podman pod ps | |
``` | |
**stop the pod** | |
``` | |
systemctl --user stop pod-my-pod.service | |
podman pod ps -q | |
podman container ps -q | |
``` | |
**enable the service to start automatically** | |
``` | |
systemctl --user enable myuser.service | |
systemctl --user start myuser.service | |
``` | |
**enable the user running service to linger** | |
``` | |
sudo loginctl enable-linger [USER] | |
``` | |
## Resources | |
* https://developers.redhat.com/blog/2019/01/15/podman-managing-containers-pods | |
* https://www.redhat.com/sysadmin/podman-run-pods-systemd-services |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment