Skip to content

Commit

Permalink
fixup! Add tip about unused docker volumes cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
asaunier committed Feb 13, 2020
1 parent d7f3764 commit 5814377
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions doc/integrator/docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,14 @@ Otherwise:
docker ps --all --quiet --filter status=exited | xargs --no-run-if-empty docker rm
docker images | grep "<none>" | awk '{print $3}' | xargs --no-run-if-empty docker rmi || true
docker volume ls --quiet --filter dangling=true | grep '[0-9a-f]\{64\}' | xargs --no-run-if-empty docker volume rm
docker system prune --volumes

This will remove::

* Containers with exit status.
* Images with version on name as `<none>`.
* Unnamed dangling volumes.

To remove unused volumes created by possibly unconsistent volume declarations
in the ``Dockerfile`` compared to ``docker-compose.yml``:

.. prompt:: bash

#!/bin/bash
for vol in $(docker volume ls | awk '{print $2}' | grep -v VOLUME)
do
docker volume rm $vol
done

You can also remove the unused named images, that should be done manually:

* List the images with ``docker images``.
Expand Down

0 comments on commit 5814377

Please sign in to comment.