service-v1.j2 669 B

1234567891011121314151617181920212223
  1. {#
  2. Archetype: service-basic-v1
  3. Description:
  4. Basic service definition with image, container name (non-swarm), and hostname.
  5. This is the foundation for any Docker Compose service.
  6. Approach:
  7. - Defines the service name and image
  8. - Conditionally adds container_name only for non-swarm deployments
  9. - Sets hostname for service identification
  10. Usage:
  11. Use this as the starting point for any service definition.
  12. #}
  13. services:
  14. {{ service_name }}:
  15. image: {{ service_image }}
  16. {% if not swarm_enabled %}
  17. restart: {{ restart_policy }}
  18. container_name: {{ container_name }}
  19. {% endif %}
  20. hostname: {{ container_hostname }}