I am running to the default limit of 20 GB building images with Docker for Windows. I could easily change the disk size for one particular container by running it with --storage-opt size option:
docker run --storage-opt size=120G microsoft/windowsservercore powershell
Sadly, it does not help me because I need large disk size available during build process. I’ve tried the following:
to call dockerd --storage-opt size=120G
to call dockerd --storage-opt dm.basesize=120G
to edit docker daemon.json adding:
“storage-opts”: [
“dm.basesize=120G”
]
to edit docker daemon.json adding:
“storage-opts”: [
“size=120G”
]
Nothing helped. Does anyone have any fresh hints? I’m running out of ideas
Hm, I seem to be able to override this as a daemon opt:
.\dockerd.exe --storage-opt size=30G
docker run --storage-opt size=30G microsoft/nanoserver powershell -c get-psdrive
Name Used (GB) Free (GB) Provider Root
---- --------- --------- -------- ----
Alias Alias
C 0.16 29.72 FileSystem C:\
Here’s how to make that permanent:
net stop docker
.\dockerd --unregister-service
.\dockerd --register-service -storage-opt size=30G
net start docker
When I execute net stop docker, an error is encountered as below: Error: System error 1060 has occurred. The specified service does not exist as an installed service.
And when I execute .\dockerd, another error is encountered as below: Error: bash: .dockerd: command not found
@friism Would you please help on the process you followed on windows to get these commands executed ?
I am running into the same issue as the OP and have not been able to find any info as to how to do this on Docker for Windows. I have about 20GB that I need to copy into the container at the build stage.
From the following, it looks like I am stuck with the default overlay2 that comes with Docker for Windows:
From the following, it looks like increasing the storage above the default requires something other than overlay (which I am stuck with):
However, from this post, under " Configure Docker with Configuration File" , it says that the storage-driver and storage-opts are available for user configuration on Docker for Windows…
Note that I have tried updating the daemon.json and restarting Docker with no luck (setting “storage-driver”: “devicemapper”,“storage-opts”: [“dm.basesize=30GB”] in the json file as suggested by the post from Microsoft, but it didn’t work. “docker info” revealed no changes after a docker restart.) Is this right? Is there any way on Docker for Windows to store a large amount of data (20-40GB) inside the docker image? (I know this is bad form, but for my particular use case, it is unfortunately required…)
I had this in C:\ProgramData\docker\config\deamon.json:
{
“storage-opts”: [
“size=50GB”
]
}
I deleted the deamon.json file (obviously check if you have other relevant settings in the file you don’t want to loose) and then I was able to reconfigure as Michael Friis describes (on my Powershell prompt I had issues with .\dockerd and it seems like there is a missing dash in storage-opt in Michael’s example). What worked on my machine was:
net stop docker
dockerd --unregister-service
dockerd --register-service --storage-opt size=30G
net start docker