Should I be concerned about excess, non-running, Docker containers?

前端 未结 5 1602
花落未央
花落未央 2021-01-29 23:35

Every docker run command, or every RUN command inside a Dockerfile, creates a container. If the container is no longer running it can still be seen wit

5条回答
  •  余生分开走
    2021-01-30 00:14

    I am unsure of what performance or memory/storage penalties these non-running containers incur.

    In order to assess how much storage non-running Docker containers are using, you may run:

    docker ps --size --filter "status=exited"
    
    • --size: display total file sizes (FYI: Explain the SIZE column in "docker ps -s" and what "virtual" keyword means #1520).
    • --filter "status=exited": list only stopped containers.

    Equivalently, you could run: docker container ls --filter "status=exited"

    You may also use the command docker system df (introduced in Docker 1.13.0, January 2017) to see docker disk usage, e.g.:

    username@server:~$ docker system df
    TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
    Images              44                  28                  114.7GB             84.84GB (73%)
    Containers          86                  7                   62.43GB             41.67GB (66%)
    Local Volumes       2                   1                   0B                  0B
    Build Cache                                                 0B                  0B
    

提交回复
热议问题