Docker.qcow2 grows in size. Steadily. Constantly.
UPDATE: You might be after another issue: Docker.qcow2 never shrinks - disk space usage leak in docker for mac #371 - Please, check both and decide which one best describes your situation.
Expected behavior
Little to no change in size to ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2 when no activity with docker or any container.
Actual behavior
File grows in size. Steadily. Constantly. Even on fresh install and no containers ever created.
Information
- Full output of the diagnostics from "Diagnose & Feedback" in the menu
Docker for Mac: version: 1.13.0 (0c6d765c5)
macOS: version 10.12.2 (build: 16C67)
logs: /tmp/BDD85F0C-BA7F-478E-A60B-7278DAF80DF0/20170208-202725.tar.gz
[OK] vmnetd
[OK] dns
[OK] driver.amd64-linux
[OK] virtualization VT-X
[OK] app
[OK] moby
[OK] system
[OK] moby-syslog
[OK] db
[OK] env
[OK] virtualization kern.hv_support
[OK] slirp
[OK] osxfs
[OK] moby-console
[OK] logs
[OK] docker-cli
[OK] menubar
[OK] disk
- Diagnostic ID: BDD85F0C-BA7F-478E-A60B-7278DAF80DF0
Steps to reproduce the behavior
- Install Docker.
- Open
~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/via Finder - Highlight
Docker.qcow2 - Press
Cmd-Alt-I - Monitor the size of the file for a minute or two.
- You should see something like this
Alternatively:
- Repeat steps 1-4 from above.
- Quit Docker from the menubar.
- Wait for its processes to quit (via Activity Monitor.app or other way).
- Re-start Docker.app.
- Monitor the size of the
Docker.qcow2file. - It grows with roughly 300-400MB upon each re-start.
It grows about every 7.7s on my machine.
Got that number by running following command:
docker-qcow2-monitor | awk 'BEGIN { a=0; b="(python -c \'import time; print time.time()\')"; c=0; b|getline d; close(b) }{ if (a!=$0) { b|getline c; close(b); print (c-d)": "$0; d=c } } { a=$0 }'
awk is GNU Awk 4.1.4, API: 1.1 (GNU MPFR 3.1.5, GNU MP 6.1.2)
NOTE: you can substitute "(python -c ...)" for "(date +%s)", but it will be rounded to the second.
docker-qcow2-monitor is an executable script (in my path):
#!/usr/bin/env bash
stat -f "%z" "$HOME/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2"
sleep 0.5
exec "$0"
If I get rid of the sleep there is a burst of file size change after the initial jump and then 7.7s later it repeats.
Here's the output of above command:
0.03: 2276392960
5.62: 2278490112
7.7: 2280587264
7.7: 2282684416
7.7: 2284781568
7.7: 2286878720
7.71: 2288975872
7.7: 2291073024
7.19: 2291597312
0.51: 2293170176
7.19: 2294546432
0.51: 2295267328
7.18: 2297364480
7.68: 2299461632
7.7: 2301558784
7.68: 2303655936
7.7: 2305753088
7.68: 2307850240
7.7: 2309947392
7.7: 2312044544
7.7: 2314141696
7.7: 2316238848
7.7: 2318336000
7.68: 2320433152
7.71: 2322530304
7.71: 2324627456
7.7: 2326724608
7.69: 2328821760
7.71: 2330918912
7.69: 2333016064
7.7: 2335113216
7.69: 2337210368
7.7: 2339307520
7.7: 2341404672
7.69: 2343501824
7.7: 2345598976
7.71: 2347696128
7.7: 2349793280
7.68: 2351890432
7.7: 2353987584
7.7: 2356084736
7.21: 2357460992
0.5: 2358181888
7.18: 2360279040
7.69: 2362310656
7.68: 2364407808
7.69: 2366504960
7.69: 2368602112
7.7: 2370699264
7.7: 2372796416
7.69: 2374893568
And with no sleep:
0.0300002: 2397962240
0.33: 2398355456
0.02: 2398945280
0.04: 2399404032
0.02: 2399797248
0.03: 2400059392
7.57: 2400190464
0.02: 2400518144
0.03: 2400845824
0.03: 2401173504
0.02: 2401632256
0.02: 2402091008
0.03: 2402156544
7.53: 2402222080
0.02: 2402680832
0.03: 2403205120
0.0400002: 2403532800
0.04: 2403926016
0.03: 2404253696
7.52: 2404319232
0.03: 2404777984
0.03: 2405236736
0.03: 2405564416
0.03: 2405957632
0.0300002: 2406285312
0.04: 2406350848
7.49: 2406744064
0.02: 2407268352
0.03: 2407727104
0.03: 2408054784
0.04: 2408448000
7.56: 2408906752
0.0200002: 2409431040
0.02: 2409889792
0.03: 2410414080
0.03: 2410545152
7.58: 2410807296
0.02: 2411200512
0.03: 2411659264
0.03: 2411986944
0.0300002: 2412380160
0.03: 2412642304
7.54: 2412707840
0.02: 2413232128
0.03: 2413756416
0.03: 2414149632
0.02: 2414477312
0.03: 2414739456
7.55: 2414804992
0.02: 2415263744
0.03: 2415722496
0.03: 2416050176
0.03: 2416443392
0.03: 2416836608
7.54: 2417229824
0.02: 2417754112
0.0300002: 2418278400
0.03: 2418802688
0.02: 2418933760
An hour and a half later it has stopped at 2.43GB.
I restarted the daemon. Not doing it anymore. I'll reset it once again and check it.
Is there an underlying linux OS that installs updates and stuff upon initialisation? I thought HyperV does not need a VM.
Reset Docker once again. It does the same thing, but slower.
1.51: 1360723968 2097152
18.5: 1362821120 2097152
18.99: 1364918272 2097152
18.49: 1367015424 2097152
18.5: 1369112576 2097152
18.44: 1371209728 2097152
18.48: 1373306880 2097152
18.47: 1375404032 2097152
18.43: 1377501184 2097152
18.44: 1379598336 2097152
18.97: 1381695488 2097152
18.45: 1383792640 2097152
18.47: 1385889792 2097152
I've added a third column with the byte difference between the changes. I've checked my initial data from before. Same thing - 2,097,152 bytes difference.
So this is the new "never shrinks" thread? The older one is returning a 404 😬
@vyscond: This is regarding one particular issue with the qcow2 size. It is related to the initial state, while nothing is being done with docker, when it is supposed to be finished installing, thus the size of the supporting files (the qcow2 image) should be consistently the same, but it is not. The problem, for me, is that there is no indication that anything is supposed to be happening, but looks like the docker image is being expanded with a regular, consistent pace.
The "never shrinks" thread was regarding the same support file, but for different issue, which, in theory, is not the same - unless a process writes a chunk of bytes (with specific size), then deletes it, then writes it again, but the file subsystem writes to a different address, resulting in new allocation on the image... just my guesswork.
@vyscond what link is 404 for you? I wasn't aware it was possible to delete github issues in such a way. In any case the symptoms here do not sound like the typical "never shrinks" issue (which BTW has started to be addressed in recent releases, with more improvements still to come)
@avioli thanks for your report. I'm going to dig around in your diagnostic now and see if I can see what is going on.
@avioli I wasn't able to glean much from your logs but playing with my own system I see the qcow file growing by 2097152 approximately every 20s or so, despite having confirmed that the used filesystem space reported inside the VM is unchanging.
I've escalated this to an internal ticket so that someone who knows about these things can take a look.
Thanks again for your report.
@ijc25 I don't know what happened for real. But on last Sunday the original thread was rendering the 404 page from Github .-.
Docker.qcow2 has gotten to 20 gigs on my machine
I got the same problem. I hope this issue will be resolved soon. 😢
I've the same issue.
I had to wipe out complete qcow2 Docker machine image due to running out of disk space in less than an hour while trying to build quite big docker image around 8GB in size. I had ~50GB free on my hard drive and it got consumed in ~1 hour of heavy Docker build & run & commit cycles. My Mac computer got frozen completely and I had to hard reset it and remove qcow2 image thus loosing all my container images. I was paying attention and removing unused Docker images to save space, but qcow2 VM image was not shrinking, only growing.
13:35 $ docker version Client: Version: 17.03.1-ce API version: 1.27 Go version: go1.7.5 Git commit: c6d412e Built: Tue Mar 28 00:40:02 2017 OS/Arch: darwin/amd64
This is a blocking issue and makes Docker for Mac out of equation for practical use. I am working now on RHEL VM running on Parallels or VirtualBox.
We are also having problems with this and I regularly have to tell colleagues to delete this file when they run out of disk space. The file routinely exceeds 60gb. It would be good if there was at least some sort of 'Clear Cache' feature somewhere, it took me ages just to find out what was eating all my disk space.
$ docker version
Client:
Version: 17.03.1-ce
API version: 1.27
Go version: go1.7.5
Git commit: c6d412e
Built: Tue Mar 28 00:40:02 2017
OS/Arch: darwin/amd64
Server:
Version: 17.03.1-ce
API version: 1.27 (minimum version 1.12)
Go version: go1.7.5
Git commit: c6d412e
Built: Fri Mar 24 00:00:50 2017
OS/Arch: linux/amd64
Experimental: true
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.11.6
BuildVersion: 15G1510
Edit:
I realised I wanted this thread: https://github.com/docker/for-mac/issues/371 And that it is actually being worked on, so disregard this post.
so uh.... does anyone know if this bug was ever addressed / fixed? I've got myself a 60gb file and growing with no active containers right now.
ping @djs55 do you know?
@DennisSchwartz, so, do you suggest to simply delete the qcow2 file? I was looking into a suggestion from thread #371 to reset the client that forces the regeneration of Docker.qcow2 file. Does anyone has ever done that?
@kgiann78 I think this might be fixed with the latest MacOS update, but not sure. I've def deleted the qcow2 file before and it's fine but it'll delete all data in current containers etc.
@DennisSchwartz I don't feel it but lets hope so... In the meanwhile after your suggestion I run into this https://blog.mrtrustor.net/post/clean-docker-for-mac/ and honestly it worked as a charm! (it is OK to share links here right?)
I think there are a few different things happening here:
-
when the system is first installed the
Docker.qcow2(and now theDocker.rawon edge) grows for a few minutes before stabilising -- when I last investigated this it seemed that the filesystem itself was writing zeroes to some on-disk structures. I had hoped this would stop when the device gained the "TRIM" capability -- since the VM could simply issue "TRIM" commands instead of writing zeroes -- but this doesn't seem to be the case :/ I considered filtering out writes of zeroes in the virtual hardware implementation but this would slow down all disk writes. There may still be some mount option (or similar) which would suppress the behaviour. Since I think the total space usage stabilises at a few 100 MiBs this doesn't seem too critical. -
if containers/images are being created and destroyed then the
Docker.qcow2(and now theDocker.raw) will fill up with junk data -- this is a normal side-effect of thin-provisioning. I recommend switching to the edge channel where the space will be reclaimed whenever an image is deleted. If you'd like to start reclaiming space immediately, you can rundocker run --rm -it --privileged --pid=host walkerlee/nsenter -t 1 -m -u -i -n /sbin/fstrim /var/lib/docker
Thanks again for your report. I recommend trying the new raw file support on the edge channel -- it should be a lot faster than the qcow2 support on the stable channel.
I hava the same situation. The size of Docker.qcow2 won't shrink after I delete some images. It really make me confused.