Remove all stopped containers: “docker rm” requires at least 1 argument

前端 未结 5 1864
栀梦
栀梦 2021-02-13 12:55

I\'m reading a book on docker. It is a couple of years old.

I\'ll cite:

If you want to get rid of all your stopped containers, you can use
the output of          


        
5条回答
  •  旧时难觅i
    2021-02-13 13:16

    In order to remove all our stopped containers, you can first run

    $ docker ps -a
    

    This gives you the list of running and stopped containers, from which you can select what are the containers that you wanted to get rid. But if you want to get rid of all stopped containers, then you need to use

    $ docker container prune 
    

    This removes all stopped containers by giving you the following messages.

    Warning! This will remove all stopped containers.
    Are you sure you want to continue? [y/N] y
    Deleted Containers:
    your container id list will be printed.
    

提交回复
热议问题