Create volume directories automatically
diff --git a/docker/compose.sls b/docker/compose.sls
index 47d536c..b9535cd 100644
--- a/docker/compose.sls
+++ b/docker/compose.sls
@@ -14,6 +14,16 @@
- require:
- pkg: docker_python
+{%- for volume in container.get('volumes', []) %}
+{%- set path = volume.split(':')[0] %}
+{%- if path.startswith('/') %}
+{{ id }}_volume_{{ path }}:
+ file.directory:
+ - name: {{ path }}
+ - makedirs: true
+{%- endif %}
+{%- endfor %}
+
{{id}}_container:
dockerng.running:
- name: {{id}}