Docker-compose


basic commands

  • docker-compose up: Starts and runs all services defined in the docker-compose.yml file.
  • docker-compose down: Stops and removes all containers and networks created by docker-compose up.
  • docker-compose build: Builds images for the services defined in docker-compose.yml.
  • docker-compose ps: Lists the current state of your services.


Additional Commands



  • docker-compose start: Starts existing containers for the services.
  • docker-compose stop: Stops existing containers for the services.
  • docker-compose restart: Restarts existing containers for the services.
  • docker-compose logs: Displays logs from containers.
  • docker-compose exec <service> <command>: Executes a command inside a running container.
  • docker-compose rm: Removes stopped containers.
  • docker-compose pull: Pulls images for the services defined in docker-compose.yml.
  • docker-compose push: Pushes images for the services defined in docker-compose.yml.
  • docker-compose config: Validates and prints the docker-compose.yml file.
  • docker-compose scale <service>=<number>: Scales a service to a specified number of replicas.