Created
July 29, 2022 13:50
-
-
Save gwpl/37952c96e276ef3346b85c9724576ce9 to your computer and use it in GitHub Desktop.
docker cleanup - freeing disk space or building fresh regardless of cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
docker image prune -a | |
docker system prune -a # from https://www.freecodecamp.org/news/where-are-docker-images-stored-docker-container-paths-explained/ | |
#docker volumes prune # from https://www.freecodecamp.org/news/where-are-docker-images-stored-docker-container-paths-explained/ | |
# altnernatively: | |
# How to force Docker for a clean build of an image without deleting cache | |
# and btw https://stackoverflow.com/a/60140109/544721 -> docker builder prune -af | |
# | |
# docker-compose build --no-cache && | |
# docker-compose up -d --force-recreate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker container prune |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://docs.docker.com/engine/reference/commandline/container_stop/