Use newer dockerng for composing containers
diff --git a/docker/compose-ng.sls b/docker/compose-ng.sls
deleted file mode 100644
index d68bea9..0000000
--- a/docker/compose-ng.sls
+++ /dev/null
@@ -1,83 +0,0 @@
-{%- from "docker/map.jinja" import compose with context %}
-{%- for name, container in compose.container.items() %}
-  {%- set id = name %}
-  {%- set required_containers = [] %}
-
-{{id}}_image:
-  docker.pulled:
-  {%- set image = container.image.split(':',1) %}
-    - name: {{image[0]}}
-    - tag: {{image[1]}}
-
-
-{{id}} container:
-  {%- if 'dvc' in container and container.dvc %}
-  docker.installed:
-  {%- else %}
-  docker.running:
-  {%- endif %}
-    - name: {{id}}
-    - image: {{container.image}}
-  {%- if 'command' in container %}
-    - command: {{container.command}}
-  {%- endif %}
-  {%- if 'environment' in container and container.environment is iterable %}
-    - environment:
-    {%- for variable, value in container.environment.iteritems() %}
-        - {{variable}}: {{value}}
-    {%- endfor %}
-  {%- endif %}
-  {%- if 'ports' in container and container.ports is iterable %}
-    - ports:
-    {%- for port_mapping in container.ports %}
-      {%- if port_mapping is string %}
-        {%- set mapping = port_mapping.split(':',2) %}
-        {%- if mapping|length < 2 %}
-      - "{{mapping[0]}}"
-        {%- else %}
-      - "{{mapping[-1]}}/tcp":
-            HostPort: "{{mapping[-2]}}"
-            HostIp: "{{mapping[-3]|d('')}}"
-        {%- endif %}
-      {%- elif port_mapping is mapping %}
-      - {{port_mapping}}
-      {%- endif %}
-    {%- endfor %}
-  {%- endif %}
-  {%- if 'volumes' in container %}
-    - volumes:
-    {%- for volume in container.volumes %}
-      - {{volume}}
-    {%- endfor %}
-  {%- endif %}
-  {%- if 'volumes_from' in container %}
-    - volumes_from:
-    {%- for volume in container.volumes_from %}
-      {%- do required_containers.append(volume) %}
-      - {{volume}}
-    {%- endfor %}
-  {%- endif %}
-  {%- if 'links' in container %}
-    - links:
-    {%- for link in container.links %}
-      {%- set name, alias = link.split(':',1) %}
-      {%- do required_containers.append(name) %}
-        {{name}}: {{alias}}
-    {%- endfor %}
-  {%- endif %}
-  {%- if 'restart' in container %}
-    - restart_policy:
-    {%- set policy = container.restart.split(':',1) %}
-        Name: {{policy[0]}}
-    {%- if policy|length > 1 %}
-        MaximumRetryCount: {{policy[1]}}
-    {%- endif %}
-  {%- endif %}
-    - require:
-      - docker: {{id}}_image
-  {%- if required_containers is defined %}
-    {%- for containerid in required_containers %}
-      - docker: {{containerid}}
-    {%- endfor %}
-  {%- endif %}
-{% endfor %}
diff --git a/docker/compose.sls b/docker/compose.sls
index a35e25a..47d536c 100644
--- a/docker/compose.sls
+++ b/docker/compose.sls
@@ -1,17 +1,68 @@
-{% from "docker/map.jinja" import compose with context %}
+{%- from "docker/map.jinja" import compose with context %}
 
-include:
-- .compose-ng
-
-compose-pip:
+docker_python:
   pkg.installed:
-    - name: python-pip
-  pip.installed:
-    - name: pip
-    - upgrade: True
+    - name: python-docker
 
-compose:
-  pip.installed:
-    - name: docker-compose{# == {{ compose.version }}#}
+{%- for name, container in compose.container.items() %}
+  {%- set id = name %}
+  {%- set required_containers = [] %}
+
+{{id}}_image:
+  dockerng.image_present:
+    - name: {{ container.image }}
     - require:
-      - pip: compose-pip
+      - pkg: docker_python
+
+{{id}}_container:
+  dockerng.running:
+    - name: {{id}}
+    - user: {{ container.user|default("root") }}
+    - image: {{container.image}}
+  {%- if 'command' in container %}
+    - command: {{container.command}}
+  {%- endif %}
+  {%- if 'environment' in container and container.environment is iterable %}
+    - environment:
+    {%- for variable, value in container.environment.iteritems() %}
+        - {{variable}}: {{value}}
+    {%- endfor %}
+  {%- endif %}
+  {%- if 'ports' in container and container.ports is iterable %}
+    - port_bindings:
+    {% for port in container.ports %}
+      - {{ port }}
+    {% endfor %}
+  {%- endif %}
+  {%- if 'volumes' in container %}
+    - volumes:
+    {%- for volume in container.volumes %}
+      - {{volume}}
+    {%- endfor %}
+  {%- endif %}
+  {%- if 'volumes_from' in container %}
+    - volumes_from:
+    {%- for volume in container.volumes_from %}
+      {%- do required_containers.append(volume) %}
+      - {{volume}}
+    {%- endfor %}
+  {%- endif %}
+  {%- if 'links' in container %}
+    - links:
+    {%- for link in container.links %}
+      {%- set name, alias = link.split(':',1) %}
+      {%- do required_containers.append(name) %}
+        {{name}}: {{alias}}
+    {%- endfor %}
+  {%- endif %}
+  {%- if 'restart' in container %}
+    - restart_policy: {{ container.restart }}
+  {%- endif %}
+    - require:
+      - dockerng: {{id}}_image
+  {%- if required_containers is defined %}
+    {%- for containerid in required_containers %}
+      - dockerng: {{containerid}}
+    {%- endfor %}
+  {%- endif %}
+{% endfor %}