Unable to Set Image Storage Size in Daemon
Actual Behavior
Start daemon on CLI: dockerd --debug --log-level debug --experimental --storage-opt size=128G
Check size of disk: docker run -i -t --rm microsoft/dotnet-framework:3.5 cmd.exe /c dir
Notice that the size of the disk free space is about 20GiB.
Now run,
docker run -i -t --rm --storage-opt size=128G microsoft/dotnet-framework:3.5 cmd.exe /c dir
Notice that the size of the disk free space is about 128Gib.
Expected behavior
Passing --storage-opt size=128G to dockerd should result in all containers started without --storage-opt option to by default receive storage space of 128GiB.
Information
Using Windows Server 2016 version 1607 (Build 14393.1480). Using Docker EE for Windows Server.
Output of docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 107
Server Version: 17.03.1-ee-3
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: l2bridge l2tunnel nat null overlay transparent
Swarm: inactive
Default Isolation: process
Kernel Version: 10.0 14393 (14393.1480.amd64fre.rs1_release.170706-2004)
Operating System: Windows Server 2016 Datacenter
OSType: windows
Architecture: x86_64
CPUs: 8
Total Memory: 64 GiB
Name: cxtwpilotbldhv
ID: Z2TM:7LDH:BZFL:PSW3:3CKK:N5OX:35CV:NFJP:OLIF:F6WV:U2VN:M4ES
Docker Root Dir: C:\ProgramData\docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: -1
Goroutines: 18
System Time: 2017-08-12T06:47:13.1387714Z
EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Notes
- Passing
--storage-opt graphdriver.size=128Gdid not work. - Passing
--storage-opt windowsfilter.size=128Gdid not work. - Passing
-storage-opt windowsgraphdriver.size=128Gdid not work.
@darrenstahlmsft @jhowardmsft @friism
Why run will not work?
The problem is that the docker build command does not take a --storage-opt option. So, there is no way to specify a larger disk at build time even if it can be specified at run time.
@vikalyan Could you open this under https://github.com/moby/moby - it's not specific to D4W.
@thajeztah, @johnstep @friism @mlaventure @crosbymichael - As far as I can tell, this won't work for any graph driver (ignoring the fact that many of the Linux graphdrivers don't accept options). It seems generic to all platforms and graphdrivers. The problem looks to be here: https://github.com/moby/moby/blob/master/daemon/create.go#L138.
The StorageOpts in the HostConfig are being set from just the create parameters, and aren't merging any daemon global storage options (held in daemon.configStore.GraphOptions). Is this by deliberate design? I'm wondering if some refactoring was done that may have removed a merge. I can easily submit a PR to fix if this isn't by design from https://github.com/moby/moby/compare/master...Microsoft:jjh/mergestorageopt.
With this fix:

Already an issue at https://github.com/moby/moby/issues/34074
@jhowardmsft Given @darrenstahlmsft comments, do you still want me to open a new issue? Shall I leave this open till your PR is completed?
Either way is fine
@jhowardmsft Looks good. Latest build (Aug 15 2300 hrs) from master.dockerproject.org looks good in a preliminary test.
Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.
If you have found a problem that seems similar to this, please open a new issue.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked