本文最后更新于 2025-09-15,文章内容可能已经过时。

Debian/Ubuntu安装Podman

apt update && apt-get -y install podman

使用命令教程参考

https://docs.podman.org.cn/en/latest/Commands.html

默认情况下,Podman 的存储位置是:

  • Root 用户/var/lib/containers/storage

  • 普通用户 (Rootless)$HOME/.local/share/containers/storage

这个位置被称为 Graph Root,它包含了所有镜像层、容器的可写层、卷数据等一切内容。

可以使用命令查看

podman info | grep "graphRoot"

键入配置 设置graphroot路径

mkdir -p /data/podman/containers

tee /etc/containers/storage.conf <<EOF
[storage]
driver = "overlay"
runroot = "/run/containers/storage"
graphroot = "/data/podman/containers"
EOF

配置加速镜像

tee /etc/containers/registries.conf <<'EOF'
unqualified-search-registries = ["docker.io"]

[[registry]]
prefix = "docker.io"
location = "hub.1panel.dev"
insecure = true

[[registry]]
prefix = "ghcr.io"
location = "ghcr.nju.edu.cn"
insecure = true

[[registry]]
prefix = "gcr.io"
location = "gcr.nju.edu.cn"
insecure = true

EOF