# . represents that the Dockerfile is present in the location where you are running this command.
podman build -t podman-image:1.0 .
Saving images to your local in archive
podman image save -o image.tar <image-id>
Load a container from a stored archive
podman load -i archive_name.tar
Tagging an image
podman tag <image-id> target-image-name
# Tagging images with a tag
podman tag -t <image-id> target-image-name:tag
Containers
Listing the containers that are running.
podman ps
Listing all containers in your machine
podman ps -a
Running a container
# Running a container normally
podman run <image-id>
# Running a container in detached mode
podman run -d <image-id>
# Adding a name
podman run -d--name jenkins <image-id>
# 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_path
podman cp file_path_in_your_podman_machine container_id:path_in_your_container
# Copying files from your container to your podman machine
podman cp container_id:path_in_your_container file_path_in_your_podman_machine
Logging into a container
podman exec-it <container-id> /bin/bash
# Logging in as a root user
podman exec-it--user root <container-id> /bin/bash
Creating an image from a container
podaman commit <container-ID> image_name
Inspecting a container
podman inspect <container-id>
Network
Listing Networks
podman network ls
Creating a network
podman network create net-1
Removing a network
podman network rm net-1
Attaching network to a container
podman network connect <container-id>
Attaching network at while running the container
podman run -d--network net-1 --name jenkins <image-id>
Inspecting a network
podman network inspect net-1
Volumes
Creating a volume
podman volume create volume-1
Listing Volumes
podman volume ls
Removing Volumes
podman volume rm volume-1
Removing unused volumes in your machine
podman volume prune
Attaching Volume while running the container
podman run -d--volume volume-1:/var/jenkins_home --network net-1 --name jenkins <image-id>
Top comments (0)
Subscribe
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)