docker info: are huge (tens-of-thousands) container counts normal?

Question: Is it normal, so many containers and images?
Containers: 12298
Images: 53

This is my docker info output.
I’ve just already removed ‘unused’ images by
docker rmi -f $(docker images | grep "<none>" | awk "{print \$3}")

  • boot2docker - An error occurred trying to connect when running docker version command
  • Access Docker Container App from phone on local network
  • Changing the configuration of zookeeper docker image
  • On Bluemix - handling volume for container group instances
  • Can't run Cassandra on Docker with Spark
  • modify a container in stopped state
  • And have better output:

    REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
    ms3_web            latest              29be36b03920        7 hours ago         824.5 MB
    ms3_nginx          latest              1ca3183075d8        14 hours ago        206.5 MB
    <none>              <none>              2f77583dfd8c        3 weeks ago         686 MB
    python              3.4                 285252a442bf        4 weeks ago         686 MB
    postgres            latest              0ded1aedd6ed        4 weeks ago         265.9 MB
    tutum/nginx         latest              30a6f176d2a9        5 months ago        206.5 MB
    
    Containers: 12298
    Images: 53
    Server Version: 1.9.1
    Storage Driver: aufs
     Root Dir: /var/lib/docker/aufs
     Backing Filesystem: extfs
     Dirs: 24657
     Dirperm1 Supported: false
    Execution Driver: native-0.2
    Logging Driver: json-file
    Kernel Version: 3.13.0-68-generic
    Operating System: Ubuntu 14.04.3 LTS
    CPUs: 1
    Total Memory: 994 MiB
    

    I use docker-compose for running my containers.

    Should I cear Containers and Images?

  • How to know server's IP address where jenkins deploys and builds code
  • Pushing a docker image into Artifactory via the publishing mechanism in gradle
  • Dockerfile with node, java, and Dynamodblocal
  • NodeJS & Docker: How to change the default Context an App is under: e.g. /myapp/stuff rather than /stuff
  • Why the virtual size still the same after delete a file from container with rm?
  • Writing to docker volume from Dockerfile does not work
  • One Solution collect form web for “docker info: are huge (tens-of-thousands) container counts normal?”

    Every time you type docker-compose up you are initiating some number of containers to do your task. Twelve thousand sounds like a lot, but really Docker is just a new way to run a process. It’s not like a traditional virtual machine. A lot of people balk at the “sizes” of images they’re seeing, but because of how Docker works, it’s not using up all that space for each of the images. It’s only storing the filesystem layers, which are much smaller than the images they are based off. Personally, I like to keep my containers and images trimmed, but that’s a matter of preference. You are not harming your system by keeping around all of those exited containers. For anyone else, you can get a list of all those containers (including containers that have exited and are no longer running) by typing docker ps -a and checking out the list. There are examples online showing ways to trim your exited containers, such as:

    docker ps -aq --no-trunc -f status=exited | xargs docker rm
    

    You can view your exited containers with a similar command:

    docker ps -a -f status=exited
    

    Something to keep in mind is that rarely you will get a container which has the status “dead” and the above command does not remove them, because our filter specifically selects only containers with “exited” status. If you want to remove all stopped containers, you can use something like this:

    docker ps -aq --no-trunc | xargs docker rm
    

    Just remember that Docker is only a way to run a process and not a full-blown VM like other software. It’s entirely up to you what you do with your system, but this isn’t nearly as bad as it sounds. You sound like you know what you’re doing, and shouldn’t have trouble keeping your containers and images nice and trimmed. Good luck!

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.