Loading

Quipoin Menu

Learn • Practice • Grow

docker / Compose Commands
tutorial

Compose Commands

Docker Compose provides a set of commands to manage your multi‑container application. Once you have a docker-compose.yml, these commands become your daily tools.

Basic Commands

  • Start all services: docker compose up (add -d to run in background).
  • Stop services: docker compose stop (stops running containers without removing them).
  • Stop and remove: docker compose down (stops containers and removes containers, networks; by default does not remove volumes).
  • Restart services: docker compose restart.
  • View logs: docker compose logs (use -f to follow).

Building and Rebuilding

If you changed a Dockerfile, rebuild images before starting:
docker compose build
Or combine with up to rebuild and start:
docker compose up --build

Executing Commands Inside a Service

To run a one‑off command in a service (like database migration):
docker compose exec service_name command
For an interactive shell:
docker compose exec web bash

Viewing and Managing Resources

List running services:
docker compose ps
View images used:
docker compose images

Cleaning Up

To remove everything (containers, networks, volumes, and images):
docker compose down -v --rmi all
Use with caution – this deletes volumes and images.


Two Minute Drill
  • docker compose up -d – start in background.
  • docker compose down – stop and remove containers/networks.
  • docker compose exec – run commands inside a running service.
  • docker compose logs -f – follow logs.
  • docker compose build – rebuild images.

Need more clarification?

Drop us an email at career@quipoinfotech.com