docker-ubuntu1804-ansible
docker-ubuntu1804-ansible copied to clipboard
systemctl command: Failed to connect to bus: No such file or directory
Hi, I'm using this image for a while for my ansible roles and now I have issue which I didn't get before.
I get error:
fatal: [Ubuntu-18.04]: FAILED! => {"changed": false, "cmd": "/bin/systemctl", "msg": "Failed to connect to bus: No such file or directory", "rc": 1, "stderr": "Failed to connect to bus: No such file or directory\n", "stderr_lines": ["Failed to connect to bus: No such file or directory"], "stdout": "", "stdout_lines": []}
This is my molecule file, with privileged and ro cgroup:
platforms:
- name: Ubuntu-18.04
image: geerlingguy/docker-ubuntu1804-ansible:latest
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
pre_build_image: true
When I login to container and run systemctl I get error:
Failed to connect to bus: No such file or directory
Same error I get for container geerlingguy/docker-debian10-ansible:latest
Looks like that is related with this issue for 20.04 also: https://github.com/geerlingguy/docker-ubuntu2004-ansible/issues/6
and if I understood that is related with new version of Docker.
Can we do something on image to bypass this problem?
What version of Docker are you using? I've got the same problem on macOS with Docker Desktop 4.5.0 on Apple Silicon. Its currently the latest version.
For now I found another solution using docker-systemctl-replacement. It's quite easy to integreate in an existing Molecule test. Here are the documentation and the instructions i followed.