Some basic docker commands

Some basic docker commands that will come handy when working with docker.

To build a docker project

docker-compose build

To build & run docker project

docker-compose up

To stop a docker project

docker-compose down

To show docker image lists

docker images

To remove a docker image

docker rmi <IMAGE ID>

To show only running containers

docker ps

To show all containers

docker ps -a

To show the latest created container

docker ps -l

To display total file size of containers

docker ps -s

To remove a container

docker rm <ID or NAME>

To run django command in docker project

docker exec -it <CONTAINER ID> python manage.py migrate

20