Almost 3 years ago I published a much-needed post around cleaning up space taken
by docker (it’s been one of the most
popular posts on this blog according to Google Analytics), but since a year or so
there’s a much better way to achieve the same.
Disk space has been one of the biggest painpoints for whoever worked with docker:
you build containers, run them and don’t bother cleaning them up :)
caches and container filesystems pile up and, before you know it, there’s some
50GB of space taken by docker.
Luckily enough, the docker CLI now has a very simple way to free space taken
by images / containers:
$ docker system prune
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all build cache
Are you sure you want to continue? [y/N]
Total reclaimed space: 513.6MB
The disadvantage of this approach is that it actually kills a few things you might
be interested in (build caches, for example), but it’s one of those instructions
each and everyone of us should dump in the crontab of our servers, or run seldom
on a local machine.
It contains 160+ pages of content dedicated to securing web applications and improving your security awareness when building
web apps, with chapters ranging from explaining how to secure HTTP cookies with the right flags to understanding why it is
important to consider joining a bug bounty program.