[ TechDocsCove ]  TechDocsCove en   ↩︎

# Creating and deleting containers in Podman

containers   linux   podman   system administration  

translations: [ es/Español ] · [ fr/Français ] · [ de/Deutsch ]


Table of contents


Podman is a robust tool for managing containers that provides a user-friendly interface for creating, managing, and deleting containers. Here, we’ll delve into the process of creating and deleting containers using Podman.

Creating a Container with Podman

To create a container with Podman, follow these steps:

Step 1: Install Podman (if not already installed)

Ensure you have Podman installed on your system. If not, you can install it based on your operating system and distribution.

Step 2: Pull an Image

Podman uses images to create containers. Pull the image you want to use from a container registry. For instance, to pull the Ubuntu image, use the following command:

SHELL
podman pull ubuntu

Step 3: Create a Container

Once the image is downloaded, you can create a container based on this image:

SHELL
podman run -d --name my_container_name ubuntu

Replace my_container_name with your preferred name for the container.

Step 4: Verify the Container

Check if the container has been created successfully:

SHELL
podman ps -a

This command lists all containers, including the newly created one.

Deleting a Container in Podman

Deleting a container in Podman is straightforward:

Step 1: Stop the Container

Ensure the container is not running:

SHELL
podman stop my_container_name

Replace my_container_name with the name of your container.

Step 2: Remove the Container

Once stopped, you can proceed to delete the container:

SHELL
podman rm my_container_name

Again, replace my_container_name with the name of the container you want to delete.

Step 3: Verify Deletion

Confirm that the container has been removed by listing the containers:

SHELL
podman ps -a

The deleted container should no longer be listed.



Created on: Dec 28, 2023


Email shareIcon for sharing via email    Reddit shareIcon for sharing via Reddit    X shareIcon for sharing via X    Telegram shareIcon for sharing via Telegram    WhatsApp shareIcon for sharing via WhatsApp    Facebook shareIcon for sharing via Facebook    LinkedIn shareIcon for sharing via LinkedIn