Monthly Archive 16 December 2020

Docker : various usefull commands

I am simply listing some usefull command I have been using with my docker setup locally. Some more commands will come with time.

1. How to remove exited container.

docker rm $(docker ps -a -f status=exited -q)

2. How to run a command inside a container. In the following example, we execute bash in php container.

docker-compose run php bash 

3. How to execute docker-compose using a specific docker-compose file.

docker-compose -f docker-compose.mac.yml run php bash