Docker 常用命令
查看所有容器
docker ps -a
停止所有容器
docker rm `docker ps -a -q`
删除所有容器
docker rm `docker ps -a -q`
删除所有镜像
docker rmi `docker images -q`
批量删除镜像,批量删除 repository name中包含dirtest中的镜像
docker images | grep 'dirtest'| awk '{print $3}'|xargs docker rmi
批量强制删除容器
docker ps -a |grep 'Exited' |awk '{print $1}' |xargs docker rm -f
同理,删除none的镜像
docker images | grep none| awk '{print $3}'|xargs docker rmi
docker 容器设置开机启动
docker update --restart=always xxx
docker 进入容器
docker exec -it 容器名或ID /bin/bash