Podman usage: Difference between revisions
From wikinotes
Line 23: | Line 23: | ||
</blockquote><!-- AutoComplete --> | </blockquote><!-- AutoComplete --> | ||
= Managing Images = | = Managing Containers/Images = | ||
<blockquote> | |||
== Image Repositories == | |||
<blockquote> | <blockquote> | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
podman search ${search} # search for an image | podman search ${search} # search for an image | ||
Line 32: | Line 33: | ||
podman pull docker.io/mediawiki:1.40-fpm # download officially supported image | podman pull docker.io/mediawiki:1.40-fpm # download officially supported image | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- --> | |||
Images | == Images == | ||
<blockquote> | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
podman images # list images | podman images # list images | ||
podman rmi ${IMAGE} # remove image (optionally w/ --force to kill containers) | podman rmi ${IMAGE} # remove image (optionally w/ --force to kill containers) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- Images --> | |||
Containerfiles | == Containerfiles == | ||
<blockquote> | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
podman build . -t ${IMAGE_NAME} # build image from 'Containerfile' in current dir as image '${IMAGE_NAME}' | podman build . -t ${IMAGE_NAME} # build image from 'Containerfile' in current dir as image '${IMAGE_NAME}' | ||
podman build -f Containerfile # specify 'Containerfile' to build | podman build -f Containerfile # specify 'Containerfile' to build | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- Containerfiles --> | |||
Containers | == Containers == | ||
<blockquote> | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
podman ps `# list running containers` | podman ps `# list running containers` | ||
Line 59: | Line 66: | ||
podman rm ${CONTAINER} # delete a container | podman rm ${CONTAINER} # delete a container | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- Containers --> | |||
</blockquote><!-- Managing Images --> | </blockquote><!-- Managing Images --> |
Revision as of 18:34, 24 September 2023
podman images contain recipes for building a container.
Instructions are typically outlined in a Containerfile
.
Documentation
man Containerfile
https://man.archlinux.org/man/community/containers-common/Containerfile.5.en podman commands https://docs.podman.io/en/latest/Commands.html
AutoComplete
# or anywhere else on your $fpath sudo touch “/usr/share/zsh/site-functions/_podman” sudo podman completion -f “/usr/share/zsh/site-functions/_podman” zsh # you may get an error, file is still generated...
Managing Containers/Images
Image Repositories
podman search ${search} # search for an image podman search ${search} --filter=is-official # search for an official image podman pull docker.io/mysql/mysql-server:latest # download an image podman pull docker.io/mediawiki:1.40-fpm # download officially supported imageImages
podman images # list images podman rmi ${IMAGE} # remove image (optionally w/ --force to kill containers)Containerfiles
podman build . -t ${IMAGE_NAME} # build image from 'Containerfile' in current dir as image '${IMAGE_NAME}' podman build -f Containerfile # specify 'Containerfile' to buildContainers
podman ps `# list running containers` podman run `# build container form image` \ --name ${CONTAINER_NAME} `# podman ps` \ -v /home/progs:/progs `# mount /home/progs in container as /progs` \ -p 80:8080 `# expose container port 80 as 8080 on host` \ -ti ${IMAGE_NAME} /bin/bash podman start ${CONTAINER} # run created/unstarted container podman exec -ti ${CONTAINER} /bin/bash # attach to started container podman stop ${CONTAINER} # stop a container podman rm ${CONTAINER} # delete a container