docker compose build image code example
Example 1: docker-compose force rebuild
# Build images before starting containers.
docker-compose up --build
# Recreate containers even if configuration/image hasn't changed.
docker-compose up --force-recreate
Example 2: docker compose run
# One single docker-compose.yml file
docker-compose up --build -d --remove-orphans
# Specify docker-compose.yml file to run
docker-compose -f docker-compose.yml up --build -d --remove-orphans