Try Try Podman

黃馨平
Jackycsie
Published in
2 min readDec 17, 2021

本篇簡單的紀錄一下,Podman 的一些基礎用法,適合給超級新手村的人快速上手,因為基礎的東西跟 docker 幾乎都一樣,難怪看網路上的人說可以直接這樣,在過程中我也常常太順打成 docker

alias docker=podman

Environment

OS: Red Hat Enterprise Linux release 8.4
Podman: 3.3.1

Step

  1. Create Dockerfile
  2. Build image
  3. Run container
  4. Stop container
# create folder,folder tree like this.[root@talwindev02 crawler_project]# tree
.
├── Dockerfile
└── requirements.txt

Below is my dockerfile. This time I only use python image. Otherwise, I install python package through “requirements.txt”.

Build image

“requirements.txt” is mean your python package list. when you use this package list. It’s more easily to management your package version and reduce your command.

In this crawler_project folder type below command.

$ podman build -t jacky_project .#show image
$ podman images
REPOSITORY TAG MAGE ID CREATED SIZE
localhost/jacky_project latest 56c2d4839287 3 hours ago 168 MB

Run container

$ podman run --name jacky_python -v /tmp:/tmp -id localhost/jacky_project$ podman ps
# Then, you can see container status.
# If you want access to container to do some action.
$ podman exec -it jacky_python /bin/bash

Stop container

$ podman stop jacky_python

Remove Container

$ podman rm jacky_python

Remove image

$ podman rmi localhost/jacky_project

原本以為從 docker 轉來 podman 會非常的麻煩,看來真的無縫轉移呢。之後再去玩 podman 的其他特色功能,再跟大家分享。

初步使用 podman 後的心得

Ref:

--

--

黃馨平
Jackycsie

閱讀本是尋常事,繁華靜處遇知音