Docker - Diff very big, how to clean?

(Sebastien Miquerolle) #1

Continuing the discussion from Beginners Guide to Deploy Discourse on Digital Ocean using Docker:


I play with Discourse on Docker since one week and I have a question/issue.
I have lot of “old” containers in the directory: /var/lib/docker/aufs/diff

642M    diff/b997997516df1fcd0c5aaf0faf02c1eaff51da926fd3b3500fb1cd45a0fb8b9e
12K     diff/e3849b644488a1b645b68852517f26a54c46c8c7d6d32d652e7d361d834d4505
643M    diff/c8bbb829d195e255cf341b2e7e24d27493b79affbabc627fd713f00cebebb473
317M    diff/c1299416c46ac8288774526c2be0f10f18ae68a05e1667feb5c04a52bb915992
641M    diff/4201e7de53b75ef0b890949902db597c68ad1e7dc36d9965adf503791dae7848
12K     diff/c4811352492c3dc566c3c8a4108a4de0908f51f0c284b011a806a7049d8f836c
642M    diff/18a99d152d7a1d201d9bb49b81c8532fe680b5cf3af0e36306a0845b8adbe7de
84M     diff/bc3ee5484189048560f24bd944ca5348edeb019b071b11937fab971b936cedaa
49M     diff/1019674a1d1efb8c8f2119c4c81ee4ecc7019f10bac36edd15de792ada09f022
642M    diff/a4948f9ad369e18ac8413b1e112e8ad76d84c20d72fe1da1d3b439c2c25d65eb
642M    diff/2f253cc5faf35569993a464e58d78c380edba684e770febe02759395091d4ab1
65M     diff/a0f5a0dc705023054c9a474d04bb79ef1c365f3557b86ff316b5ea9bbfd02338
642M    diff/c4461419975206d0bd0aef0cacb886b67d8ff65ebe48a93ded04c6c204bfd6ae
605M    diff/8f1501b1fd825b48cdd9bd0cb3cf85ae256dd3e6e3c6c30f5bce8a7748c8d1b4
327M    diff/e1bbadbe2e163e48aaadd7fd23efff61567254c83798efabf5737f395841ae51
84M     diff/eb90f75fd2a47bbad667f175b32ecd3869ab71d7b278a64f2acd78a127759e51
643M    diff/fabfa9865a47b0d8056f0a3b3ce9025d4d10cdc5f6f8964163113b96c6cc7b70
643M    diff/9e0c971478855d90526a470dd1503ca12c57570d4f08f7af9b26211a38fe70ba
643M    diff/16ca94313ac01df321cbf28ffeac09ef0fff38b4b7a8a8706527c631e44e383e
642M    diff/7b2707ca694f52132cb5fba64688319981c1a17bae8cd36ea2a7334d20898eef
24K     diff/a0f5a0dc705023054c9a474d04bb79ef1c365f3557b86ff316b5ea9bbfd02338-init
642M    diff/63eeb5796e4e655e9e87758952972351be2e7c7f6bc51c90667c6ff7b09e75e3
28K     diff/b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc
194M    diff/27cf784147099545
9.3G    diff

10G for this directory is 50% of my Digital Ocean Droplet, and I didn’t add lot of asset, just the basic install of Discourse.

So, How to clean them correctly ? It’s normal to have all of them ?


/var/lib/docker/aufs/diff increasing in size
How do I migrate data to another disk?
(YCH) #2

Try du -shx on /var/lib/docker. -x is the key.

# remove exited container.
docker ps -a|grep Exit|cut -d' ' -f 1|xargs docker rm
# remove images as possible that has no name/tag
docker images -a|grep '^<none>'|tr -s ' '|cut -d' ' -f 3|xargs docker rmi

Be careful!

(Sam Saffron) #3

Yes, this is an issue, having a look at implementing something in launcher for this, destroy should clean up properly.

(Sebastien Miquerolle) #4

Thanks, the second command line delete lot of images :slight_smile:

But somes images did’nt be delete:

Error: Conflict, c8bbb829d195 wasn't deleted
Error: Conflict, e3849b644488 wasn't deleted
Error: Conflict, 8f1501b1fd82 wasn't deleted
Error: Conflict, c4811352492c wasn't deleted
Error: Conflict, b750fe79269d wasn't deleted
Error: Conflict, 27cf78414709 wasn't deleted
2014/02/13 16:16:31 Error: failed to remove one or more images

2Go now ^^

@sam I stay tuned about any update in the docker for discourse :slight_smile:

(Sam Saffron) #5

do docker ps, are any containers stopped ? docker rm them

Found character that cannot start any token while scanning for the next token at line 86 column 1 -e LANG=en_US.UTF-8
(YCH) #6

Yes, It’s normal. Just remove images that can be.

(Jeff Atwood) #7

@sam I believe the ./launcher rebuild app automatically cleans up old containers now, doesn’t it?

(Jay Pfaffman) #8

Sorry to restart this after a year and a half, but

It doesn’t seem to. I did “./launcher rebuilt app” and it seemed that there was less space available after I ran it.

Then I did:

I got a bunch of scary “you can’t delete X because running container” messages and freed up about 10GB of space.

I’m a pretty decent sysadmin (though I’m not yet very good at docker), and this took me a while to figure out.

(Christopher Heald) #9

You may want to take a look at ./launcher cleanup.

(YCH) #10

I … ah… also don’t remember what that command exactly does. :flushed: