# Podman ## 關鍵字 * Daemon * Docker 不同,Docker 需要 root 權限和守護進程才能運行 * Podman 支援 Kubernetes (K8s) 的原生容器運行方式 (CRI-O) * OCI (Open Container Initiative) * Image (映像檔) * 執行 `container` 前需要本地端存在對應的 `image` 檔案 * 把它想像成是一個應用程式,可以在任何地方安裝 * Container (容器) * `container` 是獨立執行的一個或一組應用,以及它們的執行態環境。 * 簡易版的 `Linux` 環境 * 備註:`image` 是唯獨,`container` 啟動時建立一層可寫層在最上層 * Respository (倉庫) * 存放 `image` 的地方,通常會藉由 `Docker Hub` 來存放 `image` 供他人使用下載,也可以在本地網路建立私有的 `respository` * Registry (註冊伺服器) * 註冊伺服器(Registry)是管理 `respository` 的具體伺服器,每個伺服器上可以有多個 `respository`,而每個 `respository` 下面有多個 `image` 檔案。 * Container Image (容器映像檔) * A container image contains a packaged application, along with its dependencies, and information on what processes it runs when launched. * 檔案快照(看起來像是為了本地端的 `rollback`) * Image Layer (映像檔層)  * 每個 `image` 分層在不同的 `Layer` 上,組成一個 `image layer` 在一個 `container` 中 * 當想要共同使用某個 `image` 時,可藉由 `Image Layer` 將想要的部分抽離出來,變成一個新的 `image` 放在底層 * `image layers` 每一單位為 `image` * Tag * 在容器映像檔的概念中,`Tag` 是用於標識和版本控制映像檔的一個重要元素。 * `image` 都會有一個獨有的 `Tag` * `Tag` 通常是一個字串 * repository:tag (容器名稱:版號) * Base Image * 是用於構建和執行應用程式容器的基本映像檔 * Platform Image * 用於提供操作系統和底層軟體的映像檔,以建立與應用程式環境無關的容器 * Layer ### [Podman 官方文件](https://developers.redhat.com/blog/2018/02/22/container-terminology-practical-introduction#container_host) ### [Podman Create A Pod](https://developers.redhat.com/blog/2019/01/15/podman-managing-containers-pods#create_a_pod) ## Windows PowerShell 指令 ### 使用 Window PowerShell 安裝 podman * 檢查版本 * 可以用 cmd 打指令,也可以直接按 Windows 鍵搜尋 ``` winver ```  ``` wsl --install -d Ubuntu wsl -s Ubuntu 2 wsl -l -v wsl --shutdown ``` ### 使用 cmd 操作 Ubuntu ``` sudo apt update sudo apt upgrade sudo apt install podman podman ps podman pull docker.io/library/nginx podman run -d -p 8080:80 nginx ``` ``` // 我不小心把 install 打成 upgrade,這樣子可以直接下載最新版的 podman sudo apt upgrade podman ```   * 加上 --name 指令,可以為這一個 container 命名 ``` podman run -d -p 8080:80 --name [Container Name] nginx ```  * 查看是否架設成功 ``` 127.0.0.1:8080 localhost:8080 ```     * 停止 container 並刪除: * 如果要刪除運行中的 container,則需要使用到**強制刪除** * 強制刪除 container,請在指令 `podman rm` 後面輸入 `-f` 或是 `--force`,接上你要刪除的 container ID ``` podman rm -f [Container ID] ```  * 登出使用者,只需要按 Ctrl + D,就可以登出了 * 登入使用者: ``` wsl -u [username] ```  * S2I(請`Ted`)補充 ``` 討論是否要做 S2I 前端用 Vue3, 後端用 Java SpringBoot 2.7 來實現 S2I mount ```
×
Sign in
Email
Password
Forgot password
or
Sign in via Google
Sign in via Facebook
Sign in via X(Twitter)
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
Continue with a different method
New to HackMD?
Sign up
By signing in, you agree to our
terms of service
.