diff --git a/templates/shinyproxy-docker-compose.yml.j2 b/templates/shinyproxy-docker-compose.yml.j2
index 0c6bcd7..ee5c603 100644
--- a/templates/shinyproxy-docker-compose.yml.j2
+++ b/templates/shinyproxy-docker-compose.yml.j2
@@ -20,7 +20,7 @@ services:
       - target: {{ shinyproxy_http_port }}
         published: :{{ shinyproxy_http_port }}
         protocol: tcp
-        mode: '{{ shinyproxy_docker_http_port_mode }}'
+        mode: 'host'
 {% if shinyproxy_expose_prometheus and shinyproxy_version is version_compare('2.5.0', '>=') %}
       - target: 9090
         published: {{ shinyproxy_prometheus_port }}
@@ -31,9 +31,15 @@ services:
     image: {{ shinyproxy_docker_image }}
 {% if not shinyproxy_docker_swarm_behind_haproxy %}
     ports:
-      - {{ shinyproxy_http_port }}:{{ shinyproxy_http_port }}
+      - target: {{ shinyproxy_http_port }}
+        published: :{{ shinyproxy_http_port }}
+        protocol: tcp
+        mode: '{{ shinyproxy_docker_http_port_mode }}'
 {% if shinyproxy_expose_prometheus and shinyproxy_version is version_compare('2.5.0', '>=') %}
-      - {{ shinyproxy_prometheus_port }}:{{ shinyproxy_prometheus_port }}
+      - target: 9090
+        published: {{ shinyproxy_prometheus_port }}
+        protocol: tcp
+        mode: 'host'
 {% endif %}
 {% endif %}
 {% endif %}