Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Podman Cheatsheet

Images

Listing Images

podman images
Enter fullscreen modeExit fullscreen mode

Pulling an Image

podman pull jenkins
Enter fullscreen modeExit fullscreen mode

Deleting Images

podman rmi <image-name or image-id>
Enter fullscreen modeExit fullscreen mode

Remove un-used images at once

podman image prune
Enter fullscreen modeExit fullscreen mode
podman rmi$(podman images-aq)
Enter fullscreen modeExit fullscreen mode

Building images from a Dockerfile

# . represents that the Dockerfile is present in the location where you are running this command.podman build-t podman-image:1.0.
Enter fullscreen modeExit fullscreen mode

Saving images to your local in archive

podman image save-o image.tar <image-id>
Enter fullscreen modeExit fullscreen mode

Load a container from a stored archive

podman load-i archive_name.tar
Enter fullscreen modeExit fullscreen mode

Tagging an image

podman tag <image-id> target-image-name# Tagging images with a tagpodman tag-t <image-id> target-image-name:tag
Enter fullscreen modeExit fullscreen mode

Containers

Listing the containers that are running.

podman ps
Enter fullscreen modeExit fullscreen mode

Listing all containers in your machine

podman ps-a
Enter fullscreen modeExit fullscreen mode

Running a container

# Running a container normallypodman run <image-id># Running a container in detached modepodman run-d <image-id># Adding a namepodman run-d--name jenkins <image-id>
Enter fullscreen modeExit fullscreen mode

Stopping a container

podman stop <container-id>
Enter fullscreen modeExit fullscreen mode

Starting a stopped container

podman start <container-id>
Enter fullscreen modeExit fullscreen mode

Removing a container

podmanrm <container-id>
Enter fullscreen modeExit fullscreen mode

Logs of a container

podman logs <container-id># Watching logspodman logs--tail=100-f <container-id>
Enter fullscreen modeExit fullscreen mode

Copying files from/to a container

# Copying files to a container# It is better to copy files from you podman machine to a container rather than from your local.# podman cp source_path destination_pathpodmancpfile_path_in_your_podman_machine container_id:path_in_your_container# Copying files from your container to your podman machinepodmancpcontainer_id:path_in_your_container file_path_in_your_podman_machine
Enter fullscreen modeExit fullscreen mode

Logging into a container

podmanexec-it <container-id> /bin/bash# Logging in as a root userpodmanexec-it--user root <container-id> /bin/bash
Enter fullscreen modeExit fullscreen mode

Creating an image from a container

podaman commit <container-ID> image_name
Enter fullscreen modeExit fullscreen mode

Inspecting a container

podman inspect <container-id>
Enter fullscreen modeExit fullscreen mode

Network

Listing Networks

podman networkls
Enter fullscreen modeExit fullscreen mode

Creating a network

podman network create net-1
Enter fullscreen modeExit fullscreen mode

Removing a network

podman networkrmnet-1
Enter fullscreen modeExit fullscreen mode

Attaching network to a container

podman network connect <container-id>
Enter fullscreen modeExit fullscreen mode

Attaching network at while running the container

podman run-d--network net-1--name jenkins <image-id>
Enter fullscreen modeExit fullscreen mode

Inspecting a network

podman network inspect net-1
Enter fullscreen modeExit fullscreen mode

Volumes

Creating a volume

podman volume create volume-1
Enter fullscreen modeExit fullscreen mode

Listing Volumes

podman volumels
Enter fullscreen modeExit fullscreen mode

Removing Volumes

podman volumermvolume-1
Enter fullscreen modeExit fullscreen mode

Removing unused volumes in your machine

podman volume prune
Enter fullscreen modeExit fullscreen mode

Attaching Volume while running the container

podman run-d--volume volume-1:/var/jenkins_home--network net-1--name jenkins <image-id>
Enter fullscreen modeExit fullscreen mode

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Joined

More fromRohit Kalyan Kandulapati

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp