This repository contains a Dockerfile and necessary files to build a Docker image based on different operative systems that enables systemd service management, mounts the cgroup volume, and installs an Ansible inventory file.
Name | Docker Image | Architecture |
---|---|---|
amd64,arm64 | ||
amd64,arm64 | ||
amd64,arm64 | ||
amd64,arm64 | ||
amd64,arm64 | ||
amd64,arm64 | ||
amd64,arm64 | ||
amd64,arm64 | ||
amd64,arm64 | ||
amd64,arm64 |
-
Systemd Services: The Docker image allows you to manage systemd services inside the container, providing a more comprehensive environment for testing and development.
-
Cgroup Volume: The image mounts the cgroup volume from the host to the container, ensuring proper functioning of systemd and related services.
-
Ansible Inventory: An Ansible inventory file is installed within the container at
/etc/ansible/hosts
. This allows you to use Ansible for configuration management tasks.
- Clone this repository to your local machine:
git clone https://github.com/iamenr0s/docker-ansible-images.git
-
Ensure you have Docker installed on your system.
-
Build the Docker image:
docker build -t docker-<DISTRO>-ansible -f <DISTRO>/Dockerfile .
To run a container from the built Docker image, use the following command:
docker run -d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro docker-<DISTRO>-ansible
- The
--privileged
flag is required to run systemd inside the container. - The
-v
option mounts the host's cgroup volume to the container's cgroup directory.
-
Running systemd inside a Docker container is not a typical use case and may have security implications. It is generally recommended to use Docker for stateless services and consider alternative solutions like Kubernetes for managing stateful services with systemd requirements.
-
For more information about using this Docker image, refer to the Docker documentation.
If you encounter any issues with this Docker image or have suggestions for improvements, please open an issue on the repository.
Contributions in the form of pull requests are also welcome. Feel free to contribute to making these Docker images better!
This project is licensed under the MIT License.