Open
Description
Hi, I am trying to setup a small number of connected containers with Docker for testing. In order to assure the same behavior on any HW, I am trying to restrict the number of CPUs for each container. And I am failing at that, while using the Docker-plugin. I have tried five ways to achieve my goal. For details see the following table and comments in the example file below.
- passing raw argument to instance
- setting provider options via provider_options
- setting the argument via "cpus" in platform's details
- setting provider options
- passing raw arguments to provider
After the creation of the container, I would like to have
# docker inspect headnode | grep NanoCpus
"NanoCpus": 1000000000,
instead of
"NanoCpus": 0,
Is there any way how to, at least, pass raw arguments to the Docker? Or do I have to write my own Ansible script for managing Docker instances, as suggested in this example?
- - - - OS - - - -
PRETTY_NAME="Ubuntu 22.04.4 LTS"
- - - Molecule - - -
molecule 24.6.0 using python 3.10
ansible:2.17.0
default:24.6.0 from molecule
docker:2.1.0 from molecule_docker requiring collections: community.docker>=3.0.2 ansible.posix>=1.4.0
molecule.yml
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: headnode
image: docker.io/geerlingguy/docker-ubuntu2204-ansible
command: ${MOLECULE_DOCKER_COMMAND:-""}
pre_build_image: true
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
docker_networks: # might be used only once
- name: molecule
ipam_config:
- subnet: 172.206.0.0/16
networks:
- name: molecule
ipv4_address: 172.206.0.10
instance_raw_config_args: # 1st
- '--cpus=1.0' # 1st
provider_options: # 2nd
cpus: "1.0" # 2nd
cpus: 1 # 3rd
providers: # 4th
- name: docker # 4th
type: docker # 4th
options: # 4th
cpus: 1 # 4th
provider_raw_config_args: # 5th
- '--cpus=1.0' # 5th
provisioner:
name: ansible
verifier:
name: ansible
...
Metadata
Metadata
Assignees
Labels
No labels
Activity