• 0 Posts
  • 1 Comment
Joined 2 years ago
cake
Cake day: June 17th, 2023

help-circle
    • step 1: use named volumes
    • step 2: stop your containers or just wait for them to crash/stop unnoticed for some reason
    • step 3: run docker system prune --all as one should do periodically to clean up the garbage docker leaves on your system. Lose all your data (this will delete even named volumes if they are not in use by a running container)
    • step 4: never use named or anonymous volumes again, use bind mounts

    The fact that you absolutely need to run docker system prune --all regularly to get rid of GBs of unused layers, test containers, etc, combined with the fact that it deletes explicitely named volumes makes them too unsafe for my taste. Just use bind mounts.