To achieve the order of execution, we can use "depend_on" which needs to be added in docker-compose.yml file.  Example:  version: "2.4"
services:
backend:
build: .
depends_on:
- db
db:
image: postgres Addition of the service dependencies has various causes and effects. In this example, docker-compose up command starts DB container before backend and run as mentioned in service dependency