File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ title : " Docker or Podman"
3+ date : 2025-08-13T02:23:12+08:00
4+ description : docker 还是 podman? 选择你的本地容器服务
5+ categories : ["Linux", "introduction"]
6+ layout : search
7+ tags : ["develop"]
8+ ---
9+
10+ podman 可以简单理解为 K8S 风味的 rootless docker
11+
12+ > TL;DR 如果本地单用户 不需要容器使用显卡 就可以考虑使用podman 不然还是使用docker吧
13+
14+ 这里介绍 podman 和 docker 在使用上的核心区别
15+
16+ ## image-pull
17+
18+ podman 默认要求全名拉取镜像 即: ` podman pull docker.io/library/nginx:latest `
19+
20+ 而 docker 拉取 ` docker.io ` 默认镜像仓库时 只需要输入镜像名 即: ` docker pull nginx `
21+
22+ 当然 这个可以通过配置默认地址来解决 但是拉取后的镜像应该是 ` <registry>/<image>:<tag> `
23+
24+ ``` conf
25+ # in /etc/containers/registries.conf
26+ unqualified-search-registries = ["docker.io"]
27+ ```
28+
29+
30+ ## pod
31+
32+ podman 原生支持兼容K8S的pod 可以通过pod来管理容器间的资源限制与共享
33+
34+ ``` bash
35+ # 默认共享 ipc,net,uts
36+ podman pod create --name test_pod
37+
38+ # 启动使用指定pod的容器
39+ podman run -d --pod test_pod --name test_container alpine sleep 1000
40+ ```
41+
42+ ## storage
43+
44+ 因为 podman 默认为 rootless 所以每个用户的数据都保存在 ` ~/.local/share/containers/storage ` 没有办法共享
45+
46+ ## nvidia-driver
47+
48+ docker与podman使用nvidia-container的配置方法一致 同时启动显卡支持的容器都需要root权限
49+
50+ 但是如果平时使用 rootless 模式 这里需要提权的话 root是不与普通用户共享数据的 所以镜像会有两份 在这方面 还不如docker
You can’t perform that action at this time.
0 commit comments