Container images are the foundations that containers run on. Containers are deployed from images, so any application that needs to run in a container must be created first as an image.

Developers or administrators have two options when deploying containerized applications. The developer either builds the image or pulls it from a public repository (such as Quay.io, registry.access.redhat.com, Docker.io, or similar). Some companies also deploy private registries to centrally store custom images built by administrators and developers.

[ Getting started with containers? Check out this free online course: Running containers with Red Hat. ]

You can use Podman to manage images and containers. The podman images command lists the images that are available on a server:

$ podman images
REPOSITORY                           TAG     IMAGE ID     CREATED  SIZE
docker.io/library/redis              latest  0e403e3816e8  3 days  116 MB
docker.io/library/mysql              latest  c1558761f285  4 days  525 MB
docker.io/library/nginx              latest  c919045c4c2b  5 days  146 MB
registry.access.redhat.com/ubi8/ubi  8.5-[...]52de1277b39  9 days  235 MB
registry.access.redhat.com/ubi8/ubi  latest  52de04277b39  9 days  235 MB
quay.io/centos7/mysql-80-centos7     latest  06552cd3c0b0  2 weeks 521 MB

You can deploy containers based on the images listed because they're locally accessible. It's also possible to deploy containers based on images not locally accessible because Podman can pull an image from a repository before it's needed. But what do you do when an image isn't available locally or remotely?

Create a local image

You may not have permission or an internet connection to download an image from a public repository in some restricted environments. In that case, you need a private repository as your source of container images. In situations where private repositories are also not available, Podman offers a save command so that you can make an existing image available to your other servers.

The podman save command saves an image to an archive, making it available to be loaded on another server. For instance, to save a group of images on a host named servera:

[servera]$ podman save --output images.tar \
docker.io/library/redis \
docker.io/library/mysql \
registry.access.redhat.com/ubi8/ubi \
registry.access.redhat.com/ubi8/ubi:8.5-226.1645809065 \
quay.io/centos7/mysql-80-centos7 docker.io/library/nginx

The --output option (-o for short) specifies an output file (images.tar in this example). You can list the images you want to save by image name or by image ID.

At the time of writing, only the Docker container format supports saving multiple images, although it's a developing feature in the Open Container Initiative (OCI) format.

Load a saved container image

Once complete, you can take the file images.tar to serverb and load it with podman load:

[serverb]$ podman load --input images.tar

You can verify that the images are available by running the podman images command:

$ podman images
REPOSITORY                           TAG     IMAGE ID     CREATED  SIZE
docker.io/library/redis              latest  0e403e3816e8  3 days  116 MB
docker.io/library/mysql              latest  c1558761f285  4 days  525 MB
docker.io/library/nginx              latest  c919045c4c2b  5 days  146 MB
registry.access.redhat.com/ubi8/ubi  8.5-[...]52de1277b39  9 days  235 MB
registry.access.redhat.com/ubi8/ubi  latest  52de04277b39  9 days  235 MB
quay.io/centos7/mysql-80-centos7     latest  06552cd3c0b0  2 weeks 521 MB

Flexible Podman

It is generally recommended to use a public or private repository to store images, as this is easy to manage. And there are several other tools that focus exclusively on image transport for moving a large number of images. However, for a few images or in situations where other options aren't available, the podman save and podman load commands allow you to share images across multiple servers and systems.


关于作者

I work as Unix/Linux Administrator with a passion for high availability systems and clusters. I am a student of performance and optimization of systems and DevOps. I have passion for anything IT related and most importantly automation, high availability, and security.

UI_Icon-Red_Hat-Close-A-Black-RGB

按频道浏览

automation icon

自动化

有关技术、团队和环境 IT 自动化的最新信息

AI icon

人工智能

平台更新使客户可以在任何地方运行人工智能工作负载

open hybrid cloud icon

开放混合云

了解我们如何利用混合云构建更灵活的未来

security icon

安全防护

有关我们如何跨环境和技术减少风险的最新信息

edge icon

边缘计算

简化边缘运维的平台更新

Infrastructure icon

基础架构

全球领先企业 Linux 平台的最新动态

application development icon

应用领域

我们针对最严峻的应用挑战的解决方案

Virtualization icon

虚拟化

适用于您的本地或跨云工作负载的企业虚拟化的未来