Containerfile usage

From wikinotes

This is just a quick reference, full docs in podman usage.

Documentation

podman commands https://docs.podman.io/en/latest/Commands.html

Basics

# build image from Containerfile   # `sudo podman images`
podman build -f path/Containerfile -t ${IMAGE_NAME}

# build container form image
podman run \
    --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

# use container
sudo podman start ${CONTAINER_NAME}               # run created container
sudo podman exec -ti ${CONTAINER_NAME} /bin/bash  # attach to started container