Insights

Sitecore Docker Dependency Tracking

Sitecore Docker Pro Tips

Track Dependencies In A Docker Compose File

Services in Docker compose files can have dependencies attached to them, normally for checking the condition of one or more dependent services, i.e. database servers or supporting services.

Example:

        traefik:
    isolation: ${TRAEFIK_ISOLATION}
    image: ${TRAEFIK_IMAGE}
    command:
      - "--ping"
      - "--api.insecure=true"
      - "--providers.docker.endpoint=npipe:////./pipe/docker_engine"
      - "--providers.docker.exposedByDefault=false"
      - "--providers.file.directory=C:/etc/traefik/config/dynamic"
      - "--entryPoints.websecure.address=:443"
      - "--entryPoints.websecure.forwardedHeaders.insecure"
    ports:
      - "443:443"
      - "8079:8080"
    healthcheck:
      test: ["CMD", "traefik", "healthcheck", "--ping"]
    volumes:
      - source: \\.\pipe\docker_engine
        target: \\.\pipe\docker_engine
        type: npipe
      - ./traefik:C:/etc/traefik
    depends_on:
      id:
        condition: service_healthy
      cm:
        condition: service_healthy

    

Here we have an entry for the Traefik load balancer service which traffics network requests to the respective destinations (https://traefik.io/). See the "depends-on", which shows dependency on the health of the CM and ID service instances.

A few notes about dependency tracing.

Always start at the "depends-on" section for the affected service in the compose file and work you way down. In one instance, I had an error with spinning up a 10.2 instance. Tracing involved starting on the top entry which was traefik.

Always good idea to look at the logs of all your containers either through VSCode or Docker Desktop.

VSCode

Screenshot of the container logs in Sitecore Docker Desktop

      *  Docker Desktop

    

Screenshot of the Docker logs used diagnose errors

From these logs we can diagnose failing services or errors to track down.

Stay tuned for the next tip!

👋 Hey Sitecore Enthusiasts!

Sign up to our bi-weekly newsletter for a bite-sized curation of valuable insight from the Sitecore community.

What’s in it for you?

  • Stay up-to-date with the latest Sitecore news
  • New to Sitecore? Learn tips and tricks to help you navigate this powerful tool
  • Sitecore pro? Expand your skill set and discover troubleshooting tips
  • Browse open careers and opportunities
  • Get a chance to be featured in upcoming editions
  • Learn our secret handshake
  • And more!
Sitecore Snack a newsletter by Fishtank Consulting