Files
ansible-matzman-test/roles/docker-socket-proxy/templates/docker-compose.j2
T
2026-03-24 08:19:29 +01:00

41 lines
1.3 KiB
Django/Jinja

services:
{{ app_name }}:
image: {{ dsp_image_name }}
container_name: {{ app_name }}
environment:
- CONTAINERS=1 # Allow access to viewing containers
- SERVICES=1 # Allow access to viewing services (necessary when using Docker Swarm)
- TASKS=1 # Allow access to viewing tasks (necessary when using Docker Swarm)
- POST=0 # Disallow any POST operations (effectively read-only)
{% if app_proxy_network is none %}
ports:
- "{{ host_ip_addr}}:2375:2375/tcp"
{% endif %}
networks:
{% if app_proxy_network is not none %}
{{ app_proxy_network }}:
{% else %}
{{ app_name ~ "-net" }}:
{% endif %}
volumes:
- {{ docker_socket_path }}:/var/run/docker.sock:ro # Mounted as read-only
restart: unless-stopped
{% if app_proxy_network is not none %}
labels:
traefik.enable: true
traefik.docker.network: "{{ app_proxy_network }}"
traefik.http.routers.{{ app_name }}-http.rule: "Host(`{{ app_base_domain }}`)"
traefik.http.routers.{{ app_name }}-http.entryPoints: web
traefik.http.services.{{ app_name }}.loadbalancer.server.port: 2375
{% endif %}
networks:
{% if app_proxy_network is not none %}
{{ app_proxy_network }}:
external: true
{% else %}
{{ app_name ~ "-net" }}:
{% endif %}