services:
  with-restart:
    image: alpine
    init: true
    command: tail -f /dev/null
    depends_on:
      nginx: {condition: service_healthy, restart: true}

  no-restart:
    image: alpine
    init: true
    command: tail -f /dev/null
    depends_on:
      nginx: { condition: service_healthy }

  nginx:
    image: nginx:alpine
    healthcheck:
      test:     "echo | nc -w 5 localhost:80"
      interval: 2s
      timeout:  1s
      retries:  10
