Docker Commands

Docker reset sequence

stop all containers

docker stop $(docker ps -a -q)

remove all containers

docker rm -f $(docker ps -a -q)

remove all images

docker rmi -f $(docker images | awk {'print $3'})

build image with tag in current directory

docker build -t="” .

run image on port 80 from current directory

docker run -d -p 80:80 -w /app -v $(pwd):/  /build/

ssh into container

docker exec -ti  /bin/bash


docker run -d -i -p 8085:27017 —name coreapp_data_1  —small-files


Remove all of the images, except few

docker rmi -f $(docker images | grep -v 'selenium-chrome\|js-base\|php-base\|management-app-base' | awk {'print $3'})

Login to last container?

docker exec -ti $(!!) bash


docker run -d -w /app -v $(pwd):/app d25bfa5a9106 /


Memory and CPU use

docker stats $(docker ps -q)

tag image

docker tag 5db5f8471261 ouruser/sinatra:devel