I'm trying to remove a docker/image/container and all stuff which is somehow connected with docker, but first of all I need to stop it. While I'm trying to execute this command:
docker stop $(docker ps -a -q)
It gives me an error:
[:/home/imran] 1 $ docker stop $(docker ps -a -q)
2015/01/16 00:37:38 Get http:///var/run/docker.sock/v1.14/containers/json?all=1: dial unix /var/run/docker.sock: permission denied
Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...]
Stop a running container by sending SIGTERM and then SIGKILL after a grace period
-t, --time=10 Number of seconds to wait for the container to stop before killing it. Default is 10 seconds.
How can I uninstall a docker container?
Best Answer
I've fixed it! Please don't forget - all your data in the containers will be removed!
So, first of all we need to execute this commands:
Then we need to logout, DON'T use GUI-variant because it didn't work for me and i was dissapointed about this.
Instead, use this command:
Then we need to...
1. Kill all running containers
2. Delete all stopped containers
3. Delete all 'untagged/dangling' images
4. Delete all images
Sources:
https://www.calazan.com/docker-cleanup-commands/
http://www.linuxquestions.org/questions/ubuntu-63/how-do-i-log-out-via-terminal-928183/
P.S. Maybe other answers are correct too, but at the moment these answers were published my problem was already fixed and I'm unable to check if they are correct or not. Thanks to @Andreas. He pointed out a mistake that containers were already removed. Since I didn't find any correct and "all in one" sollution I wanna tell you how you can fix it.