Version 3 (modified by 8 years ago) ( diff ) | ,
---|
To see what containers there are :
sudo docker ps -a
sudo docker ps -l
To remove a container :
sudo docker rm desperate_galileo
To remove all containers :
sudo docker rm $(sudo docker ps -a -q)
To remove an image :
sudo docker images
sudo docker rmi 7152fe63199f
To remove all images :
sudo docker rmi $(sudo docker images -q)
To build a container :
sudo docker build -t lcbruit/redcap:v1 .
sudo docker build --no-cache -t lcbruit/redcap:v1 .
To run a container :
sudo docker run -t -i lcbruit/redcap:v1 /bin/bash
sudo docker run -p 8080:80 -d lcbruit/redcap:v1
sudo docker run -i -t -p 8080:80 lcbruit/redcap:v1 /bin/bash
To tag an image :
sudo docker tag 72d49f94ad66 lcbruit/redcap:devel
To view images :
sudo docker images lcbruit/redcap
To stop a docker :
sudo docker stop elated_bardeen
Docker logs :
sudo docker logs condescending_perlman
Misc :
sudo docker run -name redcap -i -t lcbruit/redcap:v1
sudo docker run -t -i ubuntu /bin/bash
Connect to existing container :
sudo docker exec -i -t 4cd90347c851 /bin/bash
Remove Exited Containers that are exited:
docker rm -v $(docker ps -a -q -f status=exited)
Remove Untagged Containers
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
Remove Dangling Volumes
docker volume rm $(docker volume ls -qf dangling=true)