Distinquish volumes and binds
diff --git a/docker/compose.sls b/docker/compose.sls
index b9535cd..49324ab 100644
--- a/docker/compose.sls
+++ b/docker/compose.sls
@@ -14,14 +14,27 @@
- require:
- pkg: docker_python
+{%- set binds = {} %}
+{%- set volumes = {} %}
{%- for volume in container.get('volumes', []) %}
-{%- set path = volume.split(':')[0] %}
+
+{%- set volume_parts = volume.split(':') %}
+{%- set path = volume_parts[0] %}
+
+{%- if volume_parts is iterable and volume_parts|length > 1 %}
+{# volume is bind #}
+{%- do binds.update({volume:volume}) %}
+{%- else %}
+{%- do volumes.update({volume:volume}) %}
+{%- endif %}
+
{%- if path.startswith('/') %}
{{ id }}_volume_{{ path }}:
file.directory:
- name: {{ path }}
- makedirs: true
{%- endif %}
+
{%- endfor %}
{{id}}_container:
@@ -44,12 +57,18 @@
- {{ port }}
{% endfor %}
{%- endif %}
- {%- if 'volumes' in container %}
+ {%- if volumes %}
- volumes:
- {%- for volume in container.volumes %}
+ {%- for volume in volumes.iterkeys() %}
- {{volume}}
{%- endfor %}
{%- endif %}
+ {%- if binds %}
+ - binds:
+ {%- for bind in binds.iterkeys() %}
+ - {{ bind }}
+ {%- endfor %}
+ {%- endif %}
{%- if 'volumes_from' in container %}
- volumes_from:
{%- for volume in container.volumes_from %}