How to run podman from inside a container?

后端 未结 3 864
野的像风
野的像风 2021-02-18 22:53

I want to run podman as a container to run CI/CD pipelines. However, I keep getting this error from the podman container:

         


        
3条回答
  •  南旧
    南旧 (楼主)
    2021-02-18 23:06

    The suggestion from mihai succeeds for info but as soon as I try, for example, run --rm docker.io/library/hello-world I get an error:

    error creating network namespace for container …: mount --make-rshared /var/run/netns failed: "operation not permitted"
    failed to mount shm tmpfs "/var/lib/containers/storage/vfs-containers/…/userdata/shm": operation not permitted
    

    I only managed to solve this by setting a non-root user for the image and then running the container in privileged mode, which defeats the purpose of the exercise since DinD could already do this:

    FROM ubuntu:18.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
    
    RUN adduser --disabled-login --gecos test test
    
    USER test
    
    ENTRYPOINT ["podman", "--storage-driver=vfs"]
    CMD ["info"]
    

    used as

    docker build -t podman:test .
    docker run --rm --privileged podman:test run --rm docker.io/library/hello-world
    

提交回复
热议问题