I started playing with Docker and here I will write some commands that where not so obvious at beginning 😃

List running containers:

docker ps

List also not running containers:

docker ps -a

Remove all containers (be careful with that):

docker rm $(docker ps -a -q)

Remove all images:

docker rmi $(docker images -q)

Docker won’t remove any old volumes used by containers, so after some time you may be interested in deleting them all:

docker volume rm $(docker volume ls -q)

Run container and enter bash:

docker run --name deb  -t -i debian:jessie /bin/bash

Show build logs from container:

docker logs deb

Enter bash into running container:

docker exec -it deb /bin/bash

Build image from Dockerfile in current directory:

docker build -t my_web .

After playing a little with this command I started searching for something to automate my tasks a little, and found docker-composeexternal link - you may be interested in it too.


https://techoverflow.net/blog/2013/10/22/docker-remove-all-images-and-containers/external link