$ docker stop $(docker ps -a | grep "Exited" | awk '{print $1 }') //停止容器
$ docker rm $(docker ps -a | grep "Exited" | awk '{print $1 }') //删除容器
$ docker rmi $(docker images | grep "none" | awk '{print $3}') //删除镜像
移除 images 所有 <none>镜像,
docker ps -a | grep "Exited" | awk '{print $1 }' | xargs docker stop
docker ps -a | grep "Exited" | awk '{print $1 }' | xargs docker rm
docker images | grep none | awk '{print $3 }' | xargs docker rmi
若存在容器未关闭,先执行上面停止容器, 并删除容器, 再执行该行
进入容器
docker attach 容器ID
若Ctrl +C 容器会关闭
退出容器
Ctrl+P+Q进行退出容器