paulbsd-salt/states/docker/containers.sls
2022-04-17 20:28:09 +02:00

29 lines
556 B
Plaintext

---
{%- from "docker/map.jinja" import docker with context %}
{% for k, v in docker.containers.items() -%}
{%- for i, j in v.items() %}
{% if i == "image" -%}
docker-image-{{ j }}:
docker_image.present:
- name: {{ j }}
- force: true
{% endif -%}
{%- endfor %}
{% endfor -%}
{% for k, v in docker.containers.items() -%}
docker-container-{{ k }}:
docker_container.running:
- name: {{ k }}
{%- for i, j in v.items() %}
- {{ i }}: {{ j }}
{%- endfor %}
{% endfor -%}
docker.prune:
module.run:
- docker.prune:
- images: True