geerlingguy / docker-ubuntu2004-ansible

Ubuntu 20.04 LTS (Focal Fossa) Docker container for Ansible playbook and role testing.
https://hub.docker.com/r/geerlingguy/docker-ubuntu2004-ansible
MIT License
83 stars 49 forks source link

Question regarding Podman compatibility? #10

Open c-goes opened 3 years ago

c-goes commented 3 years ago

Hello Would you accept a PR to make this image compatible with rootless podman? I realized that your Debian 10 image works without issues but this one does not. Discussion is here

https://github.com/containers/podman/issues/8545#issuecomment-840557327

This issue is probably caused by the VOLUMES in this repo's Dockerfile.

geerlingguy commented 3 years ago

What kind of changes would it entail? I have to admit I still don't use Podman much myself at this time.

c-goes commented 3 years ago

I made the PR in #11 but am not sure if everything continues to work in Docker. I made it look like your Debian image. Especially, /run mount is removed.

jwillikers commented 3 years ago

Podman support would be great.

dbrennand commented 1 year ago

Hey @c-goes @jwillikers @geerlingguy

I've been using this container image to test a PR in the geeringguy.security role.

I'm using an M1 MacBook so I installed Podman via brew, and have to run a VM for Podman via podman machine:

(ansible-role-security) ➜  ansible-role-security git:(refactor/ssh-regexp) ✗ podman --version     
podman version 4.3.1

(ansible-role-security) ➜  ansible-role-security git:(refactor/ssh-regexp) ✗ podman machine info  
Host:
  Arch: arm64
  CurrentMachine: podman-machine-default
  DefaultMachine: podman-machine-default
  EventsDir: /var/folders/04/bz4g6f_93ql7s4zv0jbz_q4h0000gn/T/podman-run--1/podman
  MachineConfigDir: /Users/dab/.config/containers/podman/machine/qemu
  MachineImageDir: /Users/dab/.local/share/containers/podman/machine/qemu
  MachineState: Running
  NumberOfMachines: 1
  OS: darwin
  VMType: qemu
Version:
  APIVersion: 4.3.1
  Built: 1668026638
  BuiltTime: Wed Nov  9 20:43:58 2022
  GitCommit: ""
  GoVersion: go1.18.8
  Os: darwin
  OsArch: darwin/arm64
  Version: 4.3.1

I've then installed molecule and the Podman molecule driver:

pip install molecule molecule-plugins

Here is my molecule.yml which has systemd working in the container for me:

---
role_name_check: 1
dependency:
  name: galaxy
driver:
  name: podman
platforms:
  - name: instance
    image: geerlingguy/docker-ubuntu2004-ansible
    tmpfs:
      - /run
      - /tmp
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
    capabilities:
      - SYS_ADMIN
    command: "/lib/systemd/systemd"
    pre_build_image: true
provisioner:
  name: ansible
  playbooks:
    converge: ${MOLECULE_PLAYBOOK:-converge.yml}
root@instance:/# systemctl is-system-running
degraded