single command to stop and remove docker container

前端 未结 11 1167
失恋的感觉
失恋的感觉 2021-01-30 15:17

Is there any command which can combine the docker stop and docker rm command together ? Each time I want to delete a running container, I need to execu

11条回答
  •  臣服心动
    2021-01-30 15:47

    In my case, to remove the running containers I used

     docker rm -f $(docker ps -a -q) 
    

    In case you also need to remove the images, then run docker rmi $(docker images -q) afterwards.

    Only run docker rmi $(docker images -q) if you want to remove the images.

提交回复
热议问题