Docker-Crib

Docker-Crib

Remove all images and container

Sometimes it is requires to remove all existing container and images. This can be done with the following

# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
Run docker as ‘docker’ instead of ‘sudo docker”

Docker requires su rights and by adding the user to the docker group the user can run docker by typing `sudo docker`, but without typing the docker password. However, by defining an alias in the bashrc file, the user can also start docker by typing ‘docker’

# Add this to ~/.bashrc
alias docker="sudo /usr/bin/docker"

# Source the .bashrc to apply the changes to the current login
source ~/.bashrc

 

Leave a Reply