Skip to main content
Hello — this lesson demonstrates practical container management and configuration using Docker-compatible tooling (Podman on RHEL-based systems). We’ll cover why containers are useful, how to install and configure Podman, and basic workflows: pulling images, running containers, mapping ports, stopping/removing containers, and cleaning up images.
A dark presentation slide reading "Demo — Manage and configure containers" with a small film-camera icon in the center-right and a "KodeKloud" logo in the top-right corner.
Why use containers?
  • Containers package an application and everything it needs (binaries, libraries, configuration, logs, and data) together. This eliminates fragmented configurations across /etc, /var/lib, /var/log, etc., and makes migration or replication to other hosts predictable and repeatable.
  • Example: A MariaDB server inside a container keeps the daemon, configuration files, databases, and logs together. Copy or pull that container on another host and it behaves the same way.
Installing Docker-compatible tooling
  • On modern RHEL-based distributions (CentOS Stream, RHEL) Docker packages may not be available; Podman is the recommended replacement. Podman is daemonless, OCI-compliant, and provides Docker-compatible CLI behavior via the podman-docker wrapper.
Install Podman with dnf:
The podman-docker package provides docker CLI compatibility so many existing Docker commands (docker pull, docker run, docker ps, etc.) work unchanged.
Podman includes a Docker-CLI compatibility wrapper (podman-docker). You can use docker ... commands, or call podman directly. Podman is daemonless and integrates with systemd and rootless workflows.
Configuring default registries (optional)
  • Container tools consult /etc/containers/registries.conf to determine search registries for unqualified image names. To prefer docker.io only, set the unqualified-search-registries array to [“docker.io”].
Example excerpt from /etc/containers/registries.conf:
  • Suppress the informational docker wrapper message by creating the marker file:
Working with images and containers (nginx walkthrough) Below is a practical workflow for finding, pulling, running, testing, and cleaning up an nginx container using the Docker-compatible CLI. Replace docker with podman if you prefer explicit Podman commands. Search for nginx images in the registry:
Pull the official nginx image (long and short forms both work):
Example pull output (truncated):
List images available locally:
Example:
Remove an older image tag:
Example output:
Creating and running containers
  • By default, running without -d attaches your terminal to the container’s stdout/stderr. Use Ctrl+C to stop.
Run in the foreground (attached):
Run detached (background):
List running containers:
List all containers (running and stopped):
Stop and remove containers:
Notes on safe image removal:
  • docker rmi fails if an image is in use by any container. Preferred safe removal sequence:
    1. Stop containers: docker stop <container>
    2. Remove containers: docker rm <container>
    3. Remove image: docker rmi <image>
Naming containers and exposing ports
  • Assign a name and publish ports with —name and -p HOST:CONTAINER. Example: run nginx named mywebserver with host port 8080 mapped to container port 80:
Testing the web server with netcat
  • Use netcat (nc) to query the server. Pass host and port as separate arguments (no colon):
You should receive the nginx default index.html content:
Press Ctrl+C to exit nc.
Ports below 1024 are privileged. To bind host port 80 to a container, run the command with elevated privileges (sudo) or map a non-privileged host port (>=1024).
Binding to privileged port 80 (example):
Getting help and Podman-specific options
  • Get detailed help for any command with —help:
Podman rm options (example excerpt):
Quick reference: common Docker/Podman commands Links and references This concludes the short hands-on introduction to pulling images, running containers, mapping ports, and cleaning up images. Practice these commands in a lab environment to build confidence and reinforce container lifecycle management.

Watch Video