Reading Time: 2 minutes

Here are some of the most useful and commonly used Docker Compose commands along with usage examples:
docker-compose upThedocker-compose upcommand is used to build and start the services defined in thedocker-compose.ymlfile.
docker-compose up
docker-compose downThedocker-compose downcommand is used to stop and remove the containers, networks, and volumes created bydocker-compose up.
docker-compose down
docker-compose buildThedocker-compose buildcommand is used to build or rebuild the services defined in thedocker-compose.ymlfile.
docker-compose build
docker-compose logsThedocker-compose logscommand is used to view the logs of the containers for the services defined in thedocker-compose.ymlfile.
docker-compose logs
docker-compose psThedocker-compose pscommand is used to show the status of the services defined in thedocker-compose.ymlfile.
docker-compose ps
docker-compose execThedocker-compose execcommand is used to execute a command in a running service.
docker-compose exec myservice ls -l
docker-compose up -dThedocker-compose up -dcommand is used to start the services defined in thedocker-compose.ymlfile in the background.
docker-compose up -d
docker-compose stopThedocker-compose stopcommand is used to stop the containers for the services defined in thedocker-compose.ymlfile.
docker-compose stop
docker-compose restartThedocker-compose restartcommand is used to restart the containers for the services defined in thedocker-compose.ymlfile.
docker-compose restart
docker-compose rmThedocker-compose rmcommand is used to remove the stopped containers for the services defined in thedocker-compose.ymlfile.
docker-compose rm
These are just some of the most commonly used and useful Docker Compose commands. There are many more commands and options available in Docker Compose, and more details can be found in the official Docker Compose documentation.
