Clean data of docker completely

Goal

Getting low on space, /var/lib/docker/aufs takes a lot of space. Need to remove all of them
1
[email protected]:/var/lib/docker/aufs# df -h
2
Filesystem Size Used Avail Use% Mounted on
3
udev 992M 0 992M 0% /dev
4
tmpfs 200M 3.2M 197M 2% /run
5
/dev/xvda1 20G 19G 708M 97% /
6
tmpfs 1000M 0 1000M 0% /dev/shm
7
tmpfs 5.0M 0 5.0M 0% /run/lock
8
tmpfs 1000M 0 1000M 0% /sys/fs/cgroup
9
tmpfs 200M 0 200M 0% /run/user/112
10
tmpfs 200M 0 200M 0% /run/user/1000
11
12
[email protected]:/var/lib/docker# du -shc *
13
16G aufs
14
4.0K containers
15
332K image
16
60K network
17
20K plugins
18
4.0K swarm
19
4.0K tmp
20
4.0K trust
21
60K volumes
22
16G total
Copied!

Solution

1
docker rm $(docker ps -a -q)
2
docker rmi --force $(docker images -q)
3
docker system prune --force
4
systemctl stop docker
5
rm -rf /var/lib/docker/aufs
6
apt-get autoclean
7
apt-get autoremove
8
systemctl start docker
Copied!
Last modified 2yr ago
Copy link
Contents
Goal
Solution