Jan Walraven
DevOps



Categories:
  • Arduino (2)
  • CSS (3)
  • Docker (11)
  • ESXi (1)
  • Git (4)
  • Google Cloud (3)
  • Javascript (6)
  • Kubernetes (4)
  • Linux (36)
  • Mac (7)
  • Magento (4)
  • Mysql (14)
  • PHP (9)
  • Zend framework 2 (9)
  • Posted on March 6, 2017

    Prune

    New in docker 1.13 is the sub-command prune.
    This sub-command can be used with container, volume, image and network.

    Delete all stopped containers

    $ docker container prune

    Delete all unused images and all dangling images

    $ docker image prune

    Prune everything at once

    The next command will prune everything in a single command.

    It will cleanup the following:

    • Stopped containers
    • all volumes not used by at least one container
    • all networks not used by at least one container
    • all dangling images

    $ docker system prune

    Docker Disk usage

    Another cool new feature is the ability to see whats in use by docker on your system.
    It also shows you how much disk space can be reclaimed by running a prune command.

    $ docker system df
    
    TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
    Images              1                   0                   771.4 MB            771.4 MB (100%)
    Containers          0                   0                   0 B                 0 B
    Local Volumes       0                   0                   0 B                 0 B
    

    Sub commands

    As you may have noticed, the Docker CLI has been growing and growing. With more than 40 commands, things were starting to get ouf of hand. This is why 1.13 puts a lot more focus on sub-commands.

    You can still use the old commands for now, but it’s probably a good idea to switch to the new style for new code.

    docker attach      ->  docker container attach
    docker commit      ->  docker container commit
    docker cp          ->  docker container cp
    docker create      ->  docker container create
    docker diff        ->  docker container diff
    docker exec        ->  docker container exec
    docker export      ->  docker container export
    docker kill        ->  docker container kill
    docker logs        ->  docker container logs
    docker pause       ->  docker container pause
    docker port        ->  docker container port
    docker inspect     ->  docker {container,image} inspect
    docker ps          ->  docker container ls
    docker rename      ->  docker container rename
    docker restart     ->  docker container restart
    docker rm          ->  docker container rm
    docker run         ->  docker container run
    docker start       ->  docker container start
    docker stats       ->  docker container stats
    docker stop        ->  docker container stop
    docker top         ->  docker container top
    docker unpause     ->  docker container unpause
    docker update      ->  docker {container,node,swarm} update
    docker wait        ->  docker container wait
    
    docker build       ->  docker image build
    docker history     ->  docker image history
    docker images      ->  docker image ls
    docker import      ->  docker image import
    docker load        ->  docker image load
    docker pull        ->  docker image pull
    docker push        ->  docker image push
    docker rmi         ->  docker image rm
    docker save        ->  docker image save
    docker tag         ->  docker image tag
    
    docker deploy      ->  docker stack deploy
    docker events      ->  docker system events