gpt4 book ai didi

docker - 如何从容器内部运行podman?

转载 作者:行者123 更新时间:2023-12-04 04:14:34 26 4
gpt4 key购买 nike

我想将podman作为运行CI/CD管道的容器运行。但是,我不断从podman容器中收到此错误:

$ podman info
ERRO[0000] 'overlay' is not supported over overlayfs
Error: could not get runtime: 'overlay' is not supported over overlayfs: backing file system is unsupported for this graph driver

我正在使用 Jenkins Kubernetes plugin编写在Kubernetes集群中作为容器运行的CI/CD管道。我已经成功编写了使用Docker-in-Docker容器运行 docker builddocker push命令的管道。

但是,在容器中运行Docker客户端和Docker Daemon会使CI/CD环境变得非常膨胀,难以配置,并且不适合使用。因此,我认为可以使用 podman从Dockerfiles构建Docker镜像,而无需使用胖Docker守护程序。

问题在于 podman 太新了,以至于我以前从未见过有人尝试过这样做,也没有足够的Podman专家来正确执行此操作。

因此,使用 podman installation instructions for Ubuntu创建了以下Dockerfile:
FROM ubuntu:16.04

RUN apt-get update -qq \
&& apt-get install -qq -y software-properties-common uidmap \
&& add-apt-repository -y ppa:projectatomic/ppa \
&& apt-get update -qq \
&& apt-get -qq -y install podman

# To keep it running
CMD tail -f /dev/null

因此,我构建了图像并按如下所示运行它:

# Build
docker build -t podman:ubuntu-16.04 .

# Run
docker run --name podman -d podman:ubuntu-16.04

然后在正在运行的容器上运行此命令时,出现错误:

$ docker exec -ti podman bash -c "podman info"

ERRO[0000] 'overlay' is not supported over overlayfs
Error: could not get runtime: 'overlay' is not supported over overlayfs: backing file system is unsupported for this graph driver

我在装有Ubuntu 16.04的计算机上安装了podman,并运行了相同的 podman info命令,得到了预期的结果:

host:
BuildahVersion: 1.8-dev
Conmon:
package: 'conmon: /usr/libexec/crio/conmon'
path: /usr/libexec/crio/conmon
version: 'conmon version , commit: '
Distribution:
distribution: ubuntu
version: "16.04"
MemFree: 2275770368
MemTotal: 4142137344
OCIRuntime:
package: 'cri-o-runc: /usr/lib/cri-o-runc/sbin/runc'
path: /usr/lib/cri-o-runc/sbin/runc
version: 'runc version spec: 1.0.1-dev'
SwapFree: 2146758656
SwapTotal: 2146758656
arch: amd64
cpus: 2
hostname: jumpbox-4b3620b3
kernel: 4.4.0-141-generic
os: linux
rootless: false
uptime: 222h 46m 33.48s (Approximately 9.25 days)
insecure registries:
registries: []
registries:
registries:
- docker.io
store:
ConfigFile: /etc/containers/storage.conf
ContainerStore:
number: 0
GraphDriverName: overlay
GraphOptions: null
GraphRoot: /var/lib/containers/storage
GraphStatus:
Backing Filesystem: extfs
Native Overlay Diff: "true"
Supports d_type: "true"
Using metacopy: "false"
ImageStore:
number: 15
RunRoot: /var/run/containers/storage
VolumePath: /var/lib/containers/storage/volumes

有谁知道我该如何解决该错误并使Podman从容器中工作?

最佳答案

您的Dockerfile也应该安装iptables:

FROM ubuntu:16.04

RUN apt-get update -qq \
&& apt-get install -qq -y software-properties-common uidmap \
&& add-apt-repository -y ppa:projectatomic/ppa \
&& apt-get update -qq \
&& apt-get -qq -y install podman \
&& apt-get install -y iptables

# To keep it running
CMD tail -f /dev/null

然后使用以下命令运行命令:
docker run -ti --rm podman:test bash -c "podman --storage-driver=vfs info"

这应该给您您期望的答复。

关于docker - 如何从容器内部运行podman?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56032747/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com