我正在读一本关于码头的书.它已经有几年了.
我会引用:
If you want to get rid of all your stopped containers,you can use
the output of docker ps -aq -f status=exited,which gets the
IDs of all stopped containers. For example:
$docker rm -v $(docker ps -aq -f status=exited)
当我运行这个时,我得到:
michael@michael-desktop:~$sudo docker rm -v $(docker ps -aq -f status=exited)
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.30/containers/json?all=1&filters=%7B%22status%22%3A%7B%22exited%22%3Atrue%7D%7D: dial unix /var/run/docker.sock: connect: permission denied
"docker rm" requires at least 1 argument(s).
See 'docker rm --help'.
Usage: docker rm [OPTIONS] CONTAINER [CONTAINER...]
Remove one or more containers
你能帮我理解我应该做些什么才能获得预期目的.
最佳答案
它可能只是意味着您没有状态为“已退出”的容器.
然后命令变为:
sudo docker rm -v
缺少任何参数都会触发您看到的错误消息.
但今天,无论如何,这将完成docker container prune
.