docker - podman 无法从 Dockerfile 构建镜像创建覆盖挂载时出错

标签 docker build podman

我收到错误,创建覆盖安装到/var/lib/containers/storage/overlay/7a617fad39ce9178c810e29aaef4af73647d8e35ae0969483059441c1c4ee9cd/merged 时出错

请在下面找到调试信息。

操作系统

root@cks-master:/vagrant/files# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.6 LTS
Release:        18.04
Codename:       bionic

Dockerfile

# cat ch5Dockerfile 
FROM bash
CMD ["ping", "killer.sh"]

构建日志

root@cks-master:/vagrant/files# podman build -t simple -f ch5Dockerfile .
STEP 1/2: FROM bash
ERRO[0000] error unmounting /var/lib/containers/storage/overlay/7a617fad39ce9178c810e29aaef4af73647d8e35ae0969483059441c1c4ee9cd/merged: invalid argument 
Error: error mounting new container: error mounting build container "6c0f88a6da54d713e18283e16521385fff736bc1a1072938fddfc6be4b3d43cc": error creating overlay mount to /var/lib/containers/storage/overlay/7a617fad39ce9178c810e29aaef4af73647d8e35ae0969483059441c1c4ee9cd/merged, mount_data="nodev,metacopy=on,lowerdir=/var/lib/containers/storage/overlay/l/BNREFG6CRAAHJ7VSYG3EUXV5UO:/var/lib/containers/storage/overlay/l/MDSWZVRVZNCOW75JF32K6D4QQC:/var/lib/containers/storage/overlay/l/4G3NS52LYHWPTKA4FURHLYMAPF,upperdir=/var/lib/containers/storage/overlay/7a617fad39ce9178c810e29aaef4af73647d8e35ae0969483059441c1c4ee9cd/diff,workdir=/var/lib/containers/storage/overlay/7a617fad39ce9178c810e29aaef4af73647d8e35ae0969483059441c1c4ee9cd/work": invalid argument
root@cks-master:/vagrant/files#

podman 版本

root@cks-master:/vagrant/files# podman version
Version:      3.4.2
API Version:  3.4.2
Go Version:   go1.15.2
Built:        Thu Jan  1 00:00:00 1970
OS/Arch:      linux/amd64
root@cks-master:/vagrant/files# 

最佳答案

问题已解决。

我还在 podman 房间中发布了该问题:https://app.element.io/#/room/#podman:fedoraproject.org

有人建议我重置 podman(命令跟踪如下),然后它提示 storage.conf,我删除了该文件并再次重置。然后就成功了。

我仍然想知道 storage.conf 内部是什么导致了这个问题,但我在调查它之前将其删除。最后它成功了,我可以继续。希望对您有所帮助。

注意:删除storage.conf文件并重置podman后,我也尝试使用docker build来检查docker是否对storage.conf文件有任何依赖关系,但是没有,docker build也成功执行了(下面的命令跟踪)

root@cks-master:~# podman system reset -f
A storage.conf file exists at /etc/containers/storage.conf
You should remove this file if you did not modified the configuration.

root@cks-master:~# rm /etc/containers/storage.conf

root@cks-master:~# podman system reset -f

root@cks-master:~# podman build -t simple -f /vagrant/files/ch5Dockerfile .
STEP 1/2: FROM bash
Resolving "bash" using unqualified-search registries (/etc/containers/registries.conf)
Trying to pull docker.io/library/bash:latest...
Getting image source signatures
Copying blob 9621f1afde84 done  
Copying blob 1dd831616e40 done  
Copying blob fd6cd28e0879 done  
Copying config 8b332999f6 done  
Writing manifest to image destination
Storing signatures
STEP 2/2: CMD ["ping", "killer.sh"]
COMMIT simple
--> cd1407a69ea
Successfully tagged localhost/simple:latest
cd1407a69ea490496d6635700958f2b5fcf2b1d01f8dd218dea0f83187e55872

root@cks-master:~# podman run --name simple simple
PING killer.sh (35.227.196.29): 56 data bytes
64 bytes from 35.227.196.29: seq=0 ttl=42 time=15.689 ms
64 bytes from 35.227.196.29: seq=1 ttl=42 time=14.662 ms
64 bytes from 35.227.196.29: seq=2 ttl=42 time=15.161 ms
^C
--- killer.sh ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 14.662/15.170/15.689 ms



root@cks-master:~# docker build -t simple -f /vagrant/files/ch5Dockerfile .
Sending build context to Docker daemon  3.141MB
Step 1/2 : FROM bash
latest: Pulling from library/bash
9621f1afde84: Pull complete 
1dd831616e40: Pull complete 
fd6cd28e0879: Pull complete 
Digest: sha256:e4624241e953934fc4c396217253d8322ebda53be3b1863cd7795541d168034f
Status: Downloaded newer image for bash:latest
 ---> 8b332999f684
Step 2/2 : CMD ["ping", "killer.sh"]
 ---> Running in 306963a83d1c
Removing intermediate container 306963a83d1c
 ---> 51dee555fd57
Successfully built 51dee555fd57
Successfully tagged simple:latest
root@cks-master:~# ^C
root@cks-master:~# 

关于docker - podman 无法从 Dockerfile 构建镜像创建覆盖挂载时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73942531/

相关文章:

docker - 库伯内特斯问题。配置文件。

docker - 如何从本地网络中的另一台计算机连接到Docker容器

docker - 在 mkdir 之后触摸文件时构建 Dockerfile 失败

javascript - webpack css-loader 无法按预期与 karma 一起工作

使用 apache poi 3.9 的 Java 程序在 XML 构建文件中遇到错误

podman - 如何使用 Podman 安排 future 的工作?

linux - Podman (libpod) 在使用 SELinux 上下文挂载 shm 时无法运行

nginx - https代理到localhost后的nginx超时

使用 cmake 构建 CUDA 目标文件

podman - 如何强制删除所有 podman 图像和子项