Docker의 Docker와 유사한 Podman의 Podman?

Oct 24 2020

Docker 내부에서 Docker를 실행할 수있는 방법과 유사한 Podman 내부에서 Podman을 실행하는 방법이 있습니까?

다음은 다른 질문을 강력하게 기반으로 한 Dockerfile의 일부입니다 .

FROM debian:10.6

RUN apt update && apt upgrade -qqy && \
    apt install -qqy iptables bridge-utils \
                     qemu-kvm libvirt-daemon libvirt-clients virtinst libvirt-daemon-system \
                     cpu-checker kmod && \
    apt -qqy install curl sudo gnupg2 && \
    echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_10/ /" > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list && \
    curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_10/Release.key | sudo apt-key add - && \
    apt update && \
    apt -qqy install podman

이제 몇 가지 테스트를 시도합니다.

$ podman run -it my/test bash -c "podman --storage-driver=vfs info" ... (long output; this works fine) $ podman run -it my/test bash -c "podman --storage-driver=vfs images"
ERRO[0000] unable to write system event: "write unixgram @000ec->/run/systemd/journal/socket: sendmsg: no such file or directory" 
REPOSITORY  TAG     IMAGE ID  CREATED  SIZE

$ podman run -it my/test bash -c "podman --storage-driver=vfs run docker.io/library/hello-world"
ERRO[0000] unable to write system event: "write unixgram @000ef->/run/systemd/journal/socket: sendmsg: no such file or directory" 
Trying to pull docker.io/library/hello-world...
Getting image source signatures
Copying blob 0e03bdcc26d7 done  
Copying config bf756fb1ae done  
Writing manifest to image destination
Storing signatures
ERRO[0003] unable to write pod event: "write unixgram @000ef->/run/systemd/journal/socket: sendmsg: no such file or directory" 
ERRO[0003] Error preparing container 66692b7ff496775499d405d538769a078f2794549955cf2409fcbcbf87f42e94: error creating network namespace for container 66692b7ff496775499d405d538769a078f2794549955cf2409fcbcbf87f42e94: mount --make-rshared /var/run/netns failed: "operation not permitted" 
Error: failed to mount shm tmpfs "/var/lib/containers/storage/vfs-containers/66692b7ff496775499d405d538769a078f2794549955cf2409fcbcbf87f42e94/userdata/shm": operation not permitted

나는 또한 다른 질문 에서 제안을 시도했지만 통과 --cgroup-manager=cgroupfs했지만 성공하지 못했습니다.

$ podman run -it my/test bash -c "podman --storage-driver=vfs --cgroup-manager=cgroupfs run docker.io/library/hello-world"
Trying to pull docker.io/library/hello-world...
Getting image source signatures
Copying blob 0e03bdcc26d7 done  
Copying config bf756fb1ae done  
Writing manifest to image destination
Storing signatures
ERRO[0003] unable to write pod event: "write unixgram @000f3->/run/systemd/journal/socket: sendmsg: no such file or directory" 
ERRO[0003] Error preparing container c3fff4d8161903aaebd6f89f3b3c06b55038e11e07b6b561dc6576ca675747a3: error creating network namespace for container c3fff4d8161903aaebd6f89f3b3c06b55038e11e07b6b561dc6576ca675747a3: mount --make-rshared /var/run/netns failed: "operation not permitted" 
Error: failed to mount shm tmpfs "/var/lib/containers/storage/vfs-containers/c3fff4d8161903aaebd6f89f3b3c06b55038e11e07b6b561dc6576ca675747a3/userdata/shm": operation not permitted

일부 네트워크 구성이 필요한 것 같습니다. 아래에서 네트워크 구성에 대한 약간의 조정이 필요할 수 있음을 시사하는 프로젝트를 찾았지만 그 맥락이 무엇인지, 여기에 적용되는지 여부는 알 수 없습니다.https://github.com/joshkunz/qemu-docker

편집 : 나는 방금 발견 /var/run/podman.sock했지만 성공하지 못했습니다.

$ sudo podman run -it -v /run/podman/podman.sock:/run/podman/podman.sock my/test bash -c "podman --storage-driver=vfs --cgroup-manager=cgroupfs run docker.io/library/hello-world"
Trying to pull my/test...
  denied: requested access to the resource is denied
Trying to pull my:test...
  unauthorized: access to the requested resource is not authorized
Error: unable to pull my/text: 2 errors occurred:
        * Error initializing source docker://my/test: Error reading manifest latest in docker.io/my/test: errors:
denied: requested access to the resource is denied
unauthorized: authentication required

        * Error initializing source docker://quay.io/my/test:latest: Error reading manifest latest in quay.io/my/test: unauthorized: access to the requested resource is not authorized

root내 사용자 아래에서 만든 이미지를 볼 수없는 것 같습니다 .

어떤 아이디어? 감사.

답변

1 ErikSjölund Oct 26 2020 at 19:29

docker.io/library/alpine 컨테이너 ls /에서 실행 하고 싶다고 가정합니다 .

표준 포드 맨

podman run --rm docker.io/library/alpine ls /

Podman의 Podman

하자의 실행 ls /A의 docker.io/library/alpine의 용기,하지만 우리는 실행이 시간 podmanA의 quay.io/podman/stable 컨테이너입니다.

명령은 다음과 같습니다.

podman \
  run \
    --privileged \
    --rm \
    --ulimit host \
    -v /dev/fuse:/dev/fuse:rw \
    -v ./mycontainers:/var/lib/containers:rw \
    quay.io/podman/stable \
      podman \
        run \
          --rm \
          --user 0 \
          docker.io/library/alpine ls 

(여기서 ./mycontainers 디렉토리 는 컨테이너 저장소로 사용됩니다)

다음은 전체 예입니다.

$ podman --version podman version 2.1.1 $ mkdir mycontainers
$ podman run --privileged --rm --ulimit host -v /dev/fuse:/dev/fuse:rw -v ./mycontainers:/var/lib/containers:rw quay.io/podman/stable podman run --rm --user 0 docker.io/library/alpine ls | head -5 Trying to pull docker.io/library/alpine... Getting image source signatures Copying blob sha256:188c0c94c7c576fff0792aca7ec73d67a2f7f4cb3a6e53a84559337260b36964 Copying config sha256:d6e46aa2470df1d32034c6707c8041158b652f38d2a9ae3d7ad7e7532d22ebe0 Writing manifest to image destination Storing signatures bin dev etc home lib $ podman run --privileged --rm --ulimit host -v /dev/fuse:/dev/fuse:rw -v ./mycontainers:/var/lib/containers:rw  quay.io/podman/stable podman images
REPOSITORY                TAG     IMAGE ID      CREATED     SIZE
docker.io/library/alpine  latest  d6e46aa2470d  4 days ago  5.85 MB

생략 -v ./mycontainers:/var/lib/containers:rw하면 약간 혼란스러운 오류 메시지가 표시 될 수 있습니다.

Error: executable file `ls` not found in $PATH: No such file or directory: OCI runtime command not found error

참조 :

  • discussion.fedoraproject.org ( $ PATH에서 찾을 수 없음에 대한 토론 )
  • github 주석 (Podman에서 Podman을 실행하는 올바른 방법에 대한 조언을 제공함)