Podman
Updated: September 28, 2024
Podman is an daemonless docker and does a better job exposing the VM (machine)
Podman is similar to docker commands enough that they can be run in place. It has increased security, unique identifier (UID) separation using namespaces, and integration with systemd.
Table of Contents
Install
- brew install podman
- choco install podman
Machine
- Only one instance of a machine can run at a time but many can exist.
- The started machine is the default machine.
- Any containers and images will always use the default machine.
- Once default machine is declared it no longer needs to be specified.
# start a default machine | --now starts the VM
podman machine init --now
# create a machine with a name (development) and start it, only works during creation.
podman machine init --now development
# start a machine with set resources
podman machine init --cpus 4 --memmory 2048 --disk-size 100 --now
# start the default machine
podman machine start
podman machine start development # eg
# if you need to run priveledges like binding common system ports <1024
podman machine set --rootful # reset with --rootful=false
# stop the machine used by podman
podman machine stop
podman machine stop development # eg
# removes all containers and images (must be stopped)
podman machine rm
# list all machines
podman machine list
# get details about a specific machine like developnment
podman machine inspect development
Connection
- Many connections can be made for connection to a single machine.
- Connections expose a machine to podman commands.
# set the connection to development
podman system connection default development
# if you can ssh... you can register a connection
podman system connection add someserver
Images
# list all local images
podman images
# remove image from local system only, not from teh remote registry
podman rmi -f image:tag
podman rmi -f c234h342344 # eg
# push image to remote registy
podman push registryURL/username/image:tag
podman push quay.io/butternuts/mynode:v1 # eg
# get historical information of container image
podman history [options] image:tag
podman history quay.io/butternuts/mynode:v1 #eg
# login to remote repository
podman login [options] registryURL
podman login quay.io
# logout from remote repository
podman logout registryURL
# pull image down from repository
podman pull [options] registryURL/username/image:tag
Run
SSH
- useful for running access from wsl
# update wsl machine that is running ubuntu
podman machine ssh sudo apt update && sudo apt upgrade -y