-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WCOW buildkit/buildx caching #2411
Comments
cc @profnandaa I wonder if this is the GC default storage limit kicking in and |
➜ ~ docker buildx inspect
Name: buildkit-exp
Driver: remote
Last Activity: 2024-04-15 13:39:20 +0000 UTC
Nodes:
Name: buildkit-exp0
Endpoint: npipe:////./pipe/buildkitd
Status: running
BuildKit version: v0.13.1
Platforms: windows/amd64
Labels:
org.mobyproject.buildkit.worker.containerd.namespace: buildkit
org.mobyproject.buildkit.worker.containerd.uuid: 80aae2c4-eafe-43af-809c-2bbee660b401
org.mobyproject.buildkit.worker.executor: containerd
org.mobyproject.buildkit.worker.hostname: DESKTOP-A7O2H12
org.mobyproject.buildkit.worker.network: cni
org.mobyproject.buildkit.worker.selinux.enabled: false
org.mobyproject.buildkit.worker.snapshotter: windows
GC Policy rule#0:
All: false
Filters: type==source.local,type==exec.cachemount,type==source.git.checkout
Keep Duration: 48h0m0s
Keep Bytes: 488.3MiB
GC Policy rule#1:
All: false
Keep Duration: 1440h0m0s
Keep Bytes: 1.863GiB
GC Policy rule#2:
All: false
Keep Bytes: 1.863GiB
GC Policy rule#3:
All: true
Keep Bytes: 1.863GiB
➜ ~ docker buildx du
ID RECLAIMABLE SIZE LAST ACCESSED
fozyq86h7n81d4gr68b00jkjb true 18.01GB* 9 hours ago
2ayz1tef4e4bq7lyoqadlox0d true 17.98GB* 7 hours ago
ifkou0cwokqo6zgea4jlqmuzt true 7.336GB* 11 hours ago
7vvwuu919c9ffzy4ot852qxmo true 5.941GB* 11 hours ago
mtxdriimlm219j2s6tynkm78w true 939.6MB* 7 hours ago
cq9f7xsqzf50nemwfzje7ugs2 true 746.8MB 11 hours ago
xxv5vxg8bur524vwnglgwudgf true 673.5MB 11 hours ago
o2a1dzv5jasbiqpfnw8dy6zfy true 174.9MB 11 hours ago
ns32won5iib26msan08j9xs4w* true 4.933kB 7 hours ago
n4qs13u4o8k7650v9fxm57gnr* true 101B 11 hours ago
n6vytn04tfgpb41ki2rd1mrcc* true 0B 7 hours ago
hg2roawofuky4ch58ty2mbhng* true 0B 11 hours ago
Shared: 50.21GB
Private: 1.595GB
Reclaimable: 51.81GB
Total: 51.81GB |
GC configured at 1.8 GB is probably not what you want with such big images. Set @profnandaa We need to look into how such a small limit happened. And maybe set a minimum for wcow as it tends to use huge images. |
That's not what you are using to build. Based on your other output the builder you are using is called |
tested with ➜ wcow-test ✗ docker buildx inspect
Name: buildkit-exp
Driver: remote
Last Activity: 2024-04-16 03:59:55 +0000 UTC
Nodes:
Name: buildkit-exp0
Endpoint: npipe:////./pipe/buildkitd
Status: running
BuildKit version: v0.13.1
Platforms: windows/amd64
Labels:
org.mobyproject.buildkit.worker.containerd.namespace: buildkit
org.mobyproject.buildkit.worker.containerd.uuid: b84d108d-a0e9-4a2e-a687-006295e0a86f
org.mobyproject.buildkit.worker.executor: containerd
org.mobyproject.buildkit.worker.hostname: DESKTOP-A7O2H12
org.mobyproject.buildkit.worker.network: cni
org.mobyproject.buildkit.worker.selinux.enabled: false
org.mobyproject.buildkit.worker.snapshotter: windows
➜ wcow-test docker buildx du
ID RECLAIMABLE SIZE LAST ACCESSED
af3fw2gwc53dxsd89n8s2sfrl true 7.336GB 14 minutes ago
sax8i4cwg8z1lpjqgrbvpajmg true 5.941GB 2 minutes ago
n2n3th25eybkblxaj6dn1vtay true 746.7MB 32 seconds ago
m1rgmim2liy644g4g4122gi6c* true 97B 32 seconds ago
i6dkls59gv6qviaapskbsdckz* true 0B 32 seconds ago
Reclaimable: 14.02GB
Total: 14.02GB |
@profnandaa I think I found the issue. If no GC is configured by the user then in Linux the default is 10% of disk: https://github.com/moby/buildkit/blob/master/cmd/buildkitd/config/gcpolicy_unix.go#L11 But on wcow it is just a constant 2GB 😬 https://github.com/moby/buildkit/blob/master/cmd/buildkitd/config/gcpolicy_windows.go#L7 |
@tonistiigi -- thanks! You think we should just do the same for WCOW for consistency? I can work on the PR. |
Let's transfer this to moby/buildkit |
Initially we had the GC Policy for Windows use only 2 GB (2e9 bytes) of disk space and this was limiting for some build scenarios that need more than that, especially ServerCore images. This commit makes the policy to use percentages as it is on Linux. Also going for 10% as it is on Linux. For instance, after the change, on a dev machine, the configured space was 74694367232 / (1 << 30) = 69.5 GiB. fixes moby#4858 docker/buildx#2411 Signed-off-by: Anthony Nandaa <[email protected]>
Initially we had the GC Policy for Windows use only 2 GB (2e9 bytes) of disk space and this was limiting for some build scenarios that need more than that, especially ServerCore images. This commit makes the policy to use percentages as it is on Linux. Also going for 10% as it is on Linux. For instance, after the change, on a dev machine, the configured space was 74694367232 / (1 << 30) = 69.5 GiB. fixes moby#4858 docker/buildx#2411 Also, refactors the diskSize logic to simplify it by bringing the `d.AsByte` function back from platform specific files to `gcpolicy.go`. Signed-off-by: Anthony Nandaa <[email protected]>
Initially we had the GC Policy for Windows use only 2 GB (2e9 bytes) of disk space and this was limiting for some build scenarios that need more than that, especially ServerCore images. This commit makes the policy to use percentages as it is on Linux. Also going for 20%, double that of Linux, since Windows images tend to be larger. fixes moby#4858 docker/buildx#2411 Also, refactors the diskSize logic to simplify it by bringing the `d.AsByte` function back from platform specific files to `gcpolicy.go`. Signed-off-by: Anthony Nandaa <[email protected]>
Initially we had the GC Policy for Windows use only 2 GB (2e9 bytes) of disk space and this was limiting for some build scenarios that need more than that, especially ServerCore images. This commit makes the policy to use percentages as it is on Linux. Also going for 20%, double that of Linux, since Windows images tend to be larger. fixes moby#4858 docker/buildx#2411 Also, refactors the diskSize logic to simplify it by bringing the `d.AsByte` function back from platform specific files to `gcpolicy.go`. Signed-off-by: Anthony Nandaa <[email protected]>
Initially we had the GC Policy for Windows use only 2 GB (2e9 bytes) of disk space and this was limiting for some build scenarios that need more than that, especially ServerCore images. This commit makes the policy to use percentages as it is on Linux. Also going for 20%, double that of Linux, since Windows images tend to be larger. fixes moby#4858 docker/buildx#2411 Also, refactors the diskSize logic to simplify it by bringing the `d.AsByte` function back from platform specific files to `gcpolicy.go`. Signed-off-by: Anthony Nandaa <[email protected]>
Initially we had the GC Policy for Windows use only 2 GB (2e9 bytes) of disk space and this was limiting for some build scenarios that need more than that, especially ServerCore images. This commit makes the policy to use percentages as it is on Linux. Also going for 20%, double that of Linux, since Windows images tend to be larger. fixes moby#4858 docker/buildx#2411 Also, refactors the diskSize logic to simplify it by bringing the `d.AsByte` function back from platform specific files to `gcpolicy.go`. Signed-off-by: Anthony Nandaa <[email protected]>
Initially we had the GC Policy for Windows use only 2 GB (2e9 bytes) of disk space and this was limiting for some build scenarios that need more than that, especially ServerCore images. This commit makes the policy to use percentages as it is on Linux. Also going for 20%, double that of Linux, since Windows images tend to be larger. fixes moby#4858 docker/buildx#2411 Also, refactors the diskSize logic to simplify it by bringing the `d.AsByte` function back from platform specific files to `gcpolicy.go`. Signed-off-by: Anthony Nandaa <[email protected]> (cherry picked from commit a5f9e42)
Initially we had the GC Policy for Windows use only 2 GB (2e9 bytes) of disk space and this was limiting for some build scenarios that need more than that, especially ServerCore images. This commit makes the policy to use percentages as it is on Linux. Also going for 20%, double that of Linux, since Windows images tend to be larger. fixes moby#4858 docker/buildx#2411 Also, refactors the diskSize logic to simplify it by bringing the `d.AsByte` function back from platform specific files to `gcpolicy.go`. Signed-off-by: Anthony Nandaa <[email protected]> (cherry picked from commit a5f9e42)
Contributing guidelines
I've found a bug and checked that ...
Description
For some reason, specifically buildx, does not cache unpacked Windows Servercore image, but does Windows Nanoserver.
Buildkit, on the other hand, does cache stages from both images properly.
Steps to reproduce
1.1. Build nanoserver image using buildx
1.2. Build nanoserver image using buildx again (caching works)
1.3. Build servercore image using buildx
1.4. Build servercore image using buildx again (caching does not work)
2.1 Build nanoserver image using buildctl
2.2 Build nanoserver image using buildctl again (caching works)
2.3 Build servercore image using buildctl
2.4 Build servercore image using buildctl again (caching works)
3.1 Build nanoserver image using buildx (it loaded cache from buildkit node)
3.2 Build servercore image using buildx (it loaded cache from buildkit node)
Expected behaviour
Following builds to skip unchanged stages.
Actual behaviour
Buildx does not save stage cache, however, is able to import it (if there is one) from Buildkit.
Buildx version
github.com/docker/buildx v0.13.1-desktop.1 2368b2ee41873b948cb607251cec573ed00f00f9
Docker info
Builders list
Configuration
Build logs
No response
Additional info
There is a seemingly related issue on the buildkit repo moby/buildkit#2274.
I tried compiling buildkitd from the master after that fix was merged and repeating the same steps, but it did not change anything.
step1_buildkitd.log
step1_buildx.log
step1_containerd.log
step2_buildctl.log
step2_buildkitd.log
step2_containerd.log
step3_buildkitd.log
step3_buildx.log
step3_containerd.log
The text was updated successfully, but these errors were encountered: