Skip to main content

CentOS Stream 10: Use Dockerfile with Podman

Build container images automatically using a Dockerfile. Create a Dockerfile for Nginx, build it with Podman, and run the container.

May 25, 2026 4 min read
centoscentos-stream-10podmandockerfilecontainersnginx

Use Dockerfile to create container images automatically. This is useful for configuration management of container images.

Create a Dockerfile

Create a Dockerfile that installs and runs Nginx:

FROM quay.io/centos/centos:stream10
LABEL Maintainer "ServerWorld <admin@srv.world>"

RUN dnf -y install nginx
RUN echo "Dockerfile Test on Nginx" > /usr/share/nginx/html/index.html

EXPOSE 80
CMD ["/usr/sbin/nginx", "-g", "daemon off;"]

Build the Image

podman build -t srv.world/centos-nginx:latest .

Run the Container

podman run -d -p 80:80 srv.world/centos-nginx

Test Access

curl localhost

Dockerfile Instructions Reference

Instruction Description
FROM Sets the base image for subsequent instructions
MAINTAINER Sets the author field of the generated images
RUN Executes commands when the image is built
CMD Executes commands when the container is started
ENTRYPOINT Configures the container to run as an executable
LABEL Adds metadata to an image
EXPOSE Informs that the container listens on specified ports
ENV Sets environment variables
ADD Copies files, directories, or remote URLs
COPY Copies files or directories (no remote URL or auto-extract)
VOLUME Creates a mount point for external volumes
USER Sets the user name or UID
WORKDIR Sets the working directory