Difference between revisions of "Podman"

From Dogtag
Jump to: navigation, search
m
m (See Also)
 
Line 174: Line 174:
 
* [https://github.com/containers/dnsname/blob/master/README_PODMAN.md Using the dnsname plugin with Podman]
 
* [https://github.com/containers/dnsname/blob/master/README_PODMAN.md Using the dnsname plugin with Podman]
 
* [https://developers.redhat.com/blog/2019/01/15/podman-managing-containers-pods/ Podman: Managing pods and containers in a local container runtime]
 
* [https://developers.redhat.com/blog/2019/01/15/podman-managing-containers-pods/ Podman: Managing pods and containers in a local container runtime]
 +
* [[PKI ACME Container]]

Latest revision as of 22:06, 30 July 2020

Installation

$ dnf install -y podman podman-plugins

Authentication

$ podman login quay.io

Listing Images

$ podman images

Pulling an Image

To pull an image:

$ podman pull <repo>/<name>:<tag>

For example, to pull PostgreSQL image:

$ podman pull postgres

To pull PKI ACME image:

$ podman pull quay.io/dogtagpki/pki-acme:latest

Running a Container

To run a container:

$ podman run --name <container> --rm -it <image>

To run a command in a container:

$ podman run --rm -it <image> <command>

Accessing a Container

$ podman exec -it <container> <command>

Networking

To create a network:

$ podman network create example
/etc/cni/net.d/example.conflist

Edit /etc/cni/net.d/example.conflist as follows:

{
   "cniVersion": "0.4.0",
   "name": "example",
   "plugins": [
      ...
      {
         "type": "dnsname",
         "domainName": "example.com"
      }
   ]
}

Building an Image

$ podman build \
    -t <name> \
    --build-arg <arg>=<value> \
    <dir>

Tagging an Image

To tag an image:

$ podman tag <name>:<tag> <new name>:<new tag>

For example:

$ podman tag pki-acme:latest quay.io/dogtagpki/pki-acme:latest

Pushing an Image

To push an image:

$ podman push <repo>/<name>:<tag>

For example:

$ podman push quay.io/dogtagpki/pki-acme:latest

Pods

Listing Pods

$ podman pod list

Creating a Pod

$ podman pod create --name acme

Clean-up

To remove a container:

$ podman rm -f <container>

To remove all stopped containers:

$ podman container prune -f

To remove a pod:

$ podman pod rm -f <pod>

To remove all unused images:

$ podman image prune --all -f

To remove all images:

$ podman rmi -a -f

See Also