0

So I have two services run in docker containers, configured in a docker-compose.yaml. There is a dependency between them. Unlike regular dependencies where one container must be up before the other container starts, I have a service which must finish before starting the other service: service 1 updates a DB and service 2 reads from the DB.

Is there some way to perform this type of dependency check?

yivi
  • 42,438
  • 18
  • 116
  • 138
David
  • 175
  • 1
  • 2
  • 13

1 Answers1

0

Both containers will start at the same time, but you could have the code in the second container wait for the first container to signal that it is finishing before it starts. See here:

https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/

Sidecar containers in Kubernetes Jobs?

"Sidecar" containers in Kubernetes pods

arosca
  • 469
  • 7
  • 15