Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
257 views5 pages

Podman: Linux Container Management Tool

Podman is a container management tool that provides an alternative to Docker by allowing containers to be run and managed without a central daemon. It supports concepts like pods, where multiple containers can share namespaces and resources. Key differences from Docker include the ability to run containers without root privileges and not requiring a daemon process.

Uploaded by

anbuchennai82
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
257 views5 pages

Podman: Linux Container Management Tool

Podman is a container management tool that provides an alternative to Docker by allowing containers to be run and managed without a central daemon. It supports concepts like pods, where multiple containers can share namespaces and resources. Key differences from Docker include the ability to run containers without root privileges and not requiring a daemon process.

Uploaded by

anbuchennai82
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Podman is a container management tool for running and managing containers on Linux systems.

 It is like Docker in terms of functionality but has some key differences, including its ability to
run containers without a central daemon and its support for rootless containers.
 Podman is often used as an alternative to Docker, especially in environments where Docker
might not be preferred.
 One of the core concepts in Podman is the "pod."
 A pod is a group of one or more containers that share the same network namespace, storage
volumes, and other resources.
 Containers within the same pod can communicate with each other using localhost, making it
easier to set up multi-container applications.

It is often considered an alternative to Docker, offering similar functionality for running containers
but with some differences, including its ability to manage pods.

Podman is a containerization tool like Docker, but it has some key differences, including the ability to
manage containers and pods without requiring a daemon. A pod in Podman is a higher-level concept
than a container and is used to group one or more containers together, allowing them to share
network namespaces, storage volumes, and other resources. Here are some key aspects of working
with containers and pods in Podman:

1. Creating Containers:
You can create containers in Podman using the `podman run` command. For example:

# podman run -d --name my-container nginx

This command creates a detached (-d) container named "my-container" running the Nginx web
server.

2. Listing Containers:
To list the running containers, you can use:

# podman ps

3. Managing Containers:
You can start, stop, restart, and remove containers using commands like `podman start`, `podman
stop`, `podman restart`, and `podman rm`.

4. Creating Pods:
To create a pod, you can use the `podman pod create` command:

# podman pod create --name my-pod

This command creates a pod named "my-pod."

5. Adding Containers to Pods:


You can add containers to a pod when creating them or by using the `podman pod add` command:

# podman pod add my-pod -c my-container

This adds the "my-container" container to the "my-pod" pod.


6. Networking:
Containers within the same pod share the same network namespace, making it easy for them to
communicate with each other over localhost. However, you can also set up networking between
pods and containers using additional commands.

7. Storage Volumes:
You can mount storage volumes into both containers and pods to share data or configuration
between them.

8. Podman Compose:
Podman has a tool called "Podman Compose" that allows you to define and manage pods and
containers using a Compose file, like Docker Compose.

9. No Daemon:
Unlike Docker, Podman does not require a long-running daemon process to manage containers and
pods. It uses the user's privileges to interact with the container runtime.

10. Rootless Containers:


Podman supports running containers as non-root users, enhancing security.

11. Compatibility with Docker:


Podman strives to be compatible with Docker commands and container images, making it relatively
easy to transition from Docker to Podman.

Overall, Podman provides a flexible and powerful way to manage containers and pods, making it
suitable for various containerization use cases, from simple single-container deployments to complex
multi-container applications organized within pods.

Creating containers in Podman is straightforward, and it's like the process in Docker. You can use the
`podman run` command to create and start a container from a specified image. Here's how you can
create containers using Podman:

Creating Containers:
1. Pull an Image (if not already done):
Before creating a container, you may want to pull a container image from a container registry (e.g.,
Docker Hub) if it's not already available on your system. You can use the `podman pull` command for
this:

#podman pull IMAGE_NAME:TAG

Replace `IMAGE_NAME: TAG` with the name and version of the container image you want to use.

# Download the official image

#podman pull centos:stream9

#podman pull nginx


This command pulls the official Nginx and centos container image from the default container registry
(Docker Hub).

2. Create and Run a Container:


You can create and run a container using the `podman run` command. Here's the basic syntax:

#podman run [OPTIONS] IMAGE [COMMAND] [ARG...]

 -‘OPTIONS’: Various options to configure the container, such as specifying ports, volumes,
environment variables, etc.
 -‘IMAGE’: The name or ID of the container image you want to use.
 -‘COMMAND’: (Optional) The command to run inside the container.
 -‘ARG’: (Optional) Arguments to pass to the command inside the container.

For example, to create a simple Nginx container and run it in the background:

#podman run -d --name my-nginx nginx

 `-d`: Runs the container in detached mode (in the background).


 `--name my-nginx`: Assigns a custom name ("my-nginx") to the container.
 `nginx`: Specifies the container image to use.

3. Accessing the Container:


Once the container is running, you can access it by using various Podman commands, such as
`podman exec` to execute commands within the container or `podman attach` to attach to its
console.

For example, to access a shell within the running container:

#podman exec -it my-nginx /bin/bash

This command opens a shell inside the "my-nginx" container, allowing you to interact with it.

Once the container is running, you can access it. For example, if you are running a web server like
Nginx, you can open a web browser and access the web server by entering `http://localhost` in the
address bar.

4. Viewing Running Containers:


To view a list of running containers, you can use the `podman ps` command:

podman ps

This command displays information about the containers that are currently running.

5. Stopping and Removing Containers:


To stop and remove containers, you can use the `podman stop` and `podman rm` commands,
respectively:

Stop the container:


podman stop my-nginx-container

#podman stop my-nginx # Stop the container.

Remove the container:

podman rm my-nginx-container

#podman rm my-nginx # Remove the container

Replace "my-nginx" with the name or ID of your container.

6. View Container Logs:


To view the logs generated by a container, you can use the `podman logs` command:

podman logs my-nginx-container

This command will display the logs from the container named `my-nginx-container`.

These are the basic steps to create and manage containers with Podman. You can customize the
container's configuration further by using various options and flags with the `podman run`
command. Additionally, you can use Podman Compose to define and manage more complex
container setups using Compose files.

Listing Containers:
To list containers with Podman, you can use the `podman ps` command. This command provides
information about the containers that are currently running on your system. Here's how to use it:

# podman ps

This command will display a list of running containers along with details such as their container ID,
names, status, ports, and more.

Here's an example of what the output might look like:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS


NAMES

b7b1dab8f590 nginx:latest nginx -g daemon off; 3 minutes ago Up 3 minutes 0.0.0.0:8080-


>80/tcp my-nginx-container

c3af86c9c0b0 postgres:latest postgres -D /var/l 5 days ago Up 5 days 0.0.0.0:5432-


>5432/tcp my-postgres-container

Here's a breakdown of the columns in the output:

 CONTAINER ID: A unique identifier for the container.


 IMAGE: The name and version tag of the container image.
 COMMAND: The command that the container is running.
 CREATED: The time when the container was created.
 STATUS: The current status of the container (e.g., Up, Exited).
 PORTS: The ports mapped from the container to the host (if any).
 NAMES: The name assigned to the container.

By default, `podman ps` only displays running containers. To list all containers, including stopped
ones, you can use the `-a` or `--all` option:

#podman ps -a

This command will show all containers, both running and stopped.

You can also use various filtering options and formatting options with `podman ps` to customize the
output as needed. For example, you can filter containers by name, label, or other criteria.

Here's an example of listing containers by name:

#podman ps --filter name=my-container

This command will list containers with the name "my-container."

To learn more about the filtering and formatting options available with `podman ps`, you can refer to
the official Podman documentation or use the `podman ps --help` command to see the available
options and usage details.

Both `podman ps` and `podman container list` provide valuable information about your containers,
making it easy to monitor their status and manage them as needed. Choose the command that you
find more convenient or remember better.

Managing Containers:
Managing containers in Podman involves tasks such as starting, stopping, restarting, and removing
containers. You can use various Podman commands to perform these actions. Here's how to manage
containers using Podman:

1. Starting a Container:

To start a container, you can use the `podman start` command followed by the container's name or
ID:

You might also like