Building Images
The steps of creating a container image can be stored in a plain text file commonly named Containerfile or Dockerfile. The syntax for Containerfile or Dockerfile is published by Docker Inc as the Dockerfile reference.
Note
It is recommended to name the file Dockerfile to keep it compatible with the docker command line interface.
Important
To avoid copy files by mistake to the container image, a file named .containerignore or .dockerignore should be used. It is recommended to name the file .dockerignore to keep it compatible with the docker command line interface.
Workflow
Given a Dockerfile, the container image can be created from Images > Build an Image.
Container image can also be created from the command line.
podman build \
--tag registry/namespace/repository:tag \
context
Note
registryit is the location of the container image registry. For example
docker.iofor Docker Hub andquay.iofor Red Had’s Quay.namespaceit is usually represents a user or organization.
repositoryit is the mandatory identifier for the container image.
tagit is the optional identifier for variant of the container image.
contextit is the directory where the
Dockerfileis located.
Example
Given the following Dockerfile
FROM docker.io/alpine:3.21.3
RUN apk add --no-cache python3
Running
podman build \
--tag my-tutorial/python:3.12 \
examples/python0
creates a container image named my-tutorial/python:3.12 that has Python installed.