Skip to content

Latest commit

 

History

History
57 lines (30 loc) · 1.51 KB

File metadata and controls

57 lines (30 loc) · 1.51 KB

Start Project (project_name it is like a namespace)

First time after git cloning the project

docker-compose -p $project_name$ up --build or if you need to run in detached mode docker-compose -p $project_name$ up -d --build

Sub-sequent executions

docker-compose -p $project_name$ up

then you must use the same name with other docker-compose commands

View Services

  • docker-compose ps
  • docker-compose -p $project_name$ ps

View Logs

  • docker-compose logs -f $service_name$
  • docker-compose -p $project_name$ logs
  • docker-compose -p $project_name$ logs -f $service_name$

Restart all containers

docker-compose -p $project_name$ restart

Restart a specific container (service)

docker-compose -p $project_name$ restart $service_name$

Stop all running containers

docker stop $(docker ps -a -q)

The easiest way to delete the volume is to delete the whole stack

docker-compose -p $project_name$ down -v

Remove all containers

docker rm $(docker ps -a -q)

Remove all images

docker rmi $(docker images -q)

Purging All Unused or Dangling Images, Containers, Volumes, and Networks

Docker provides a single command that will clean up any resources — images, containers, volumes, and networks — that are dangling (not associated with a container):

docker system prune

To additionally remove any stopped containers and all unused images (not just dangling images), add the -a flag to the command:

docker system prune -a