geerlingguy / docker-ubuntu2204-ansible

Ubuntu 22.04 LTS (Jammy Jellyfish) Docker container for Ansible playbook and role testing.
https://hub.docker.com/r/geerlingguy/docker-ubuntu2204-ansible
MIT License
70 stars 17 forks source link

Docker containers fail to start inside the instance created from the image (docker in docker) #10

Open karolpivo opened 1 year ago

karolpivo commented 1 year ago

We are testing an Ansible role that deploys Docker and starts containers.

This works on top of the following images (docker engine gets installed and containers started):

The containers fail in all the other images that we've tried ( docker engine gets installed and docker service starts but the containers fail to start):

Containers fail to start with the following error message (the same on all the images):

Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error reopening /dev/null inside container: open /dev/null: operation not permitted: unknown

We use the recommended platform config (which works on Rocky and Centos8):

  - name: instance
    image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest"
    command: ${MOLECULE_DOCKER_COMMAND:-""}
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:rw
    cgroupns_mode: host
    privileged: true
    pre_build_image: true

I'd appreciate any suggestions on how to address this if possible.