报错
docker pull 拉取镜像失败
报错主要内容是
Check /etc/subuid and /etc/subgid: lchown /etc/gshadow: invalid argument
dockerpull docker.io/library/nginx Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. Trying to pull docker.io/library/nginx:latest... Getting imagesourcesignatures Copying blob b6698f04e005doneCopying blob 2bedaf25031adoneCopying blob cacfcdd01f30doneCopying blob 062e450697fadoneCopying blob 3c7ab7949321doneCopying blob 82454cdbf456doneCopying blob d26f27cc8c41doneError: writing blob: adding layer with blob"sha256:062e450697faa5f02a3a74eba9864ee4d79bc9cfbd65769fc6cdff2c05c6a053":Error processingtarfile(exit status1): potentially insufficient UIDs or GIDs availableinuser namespace(requested0:42for/etc/gshadow): Check /etc/subuid and /etc/subgid: lchown /etc/gshadow: invalid argument解决方法
将当前用户添加到
/etc/subuid和·/etc/subgid即可
- 检查一下所有已使用的subordinate UID段
awk-F:'{print $2, $2+$3-1}'/etc/subuid|sort-n会输出如下
100007553510000755351000075535100000165535165536231071231072296607296608362143362144427679427680493215493216558751558752624287624288689823根据这段输出挑选出一个未被使用的subordinate UID段,例如
可以这样分析一段空闲范围:
| 已用范围 | 结束 |
|---|---|
| 10000~75535 | ← 已用 |
| 75536~99999 | 空闲(但不够 65536) |
| 100000~755359 | ← 已用 |
| 755360~820895 | 完全空闲 |
因此我选择使用755360:65536段
- 添加到
/etc/subuid和·/etc/subgid
sudosh-c'echo "{username}:755360:65536" >> /etc/subuid && echo "{username}:755360:65536" >> /etc/subgid'- 刷新 Podman 配置并清理残留
podmansystem migrate