Skip to content

[BUG] storage_opt is being ignored for Windows containers #11395

@zaadeh

Description

@zaadeh

Description

Since looks like storage_opt is supported by Windows, unfortunately looks like the storage_opt key under a service is being ignored by compose for Windows containers.

Steps To Reproduce

  1. The following docker command when run on Docker Engine 25.0 on latest update of Windows Server 2022, sets the storage-opt correctly and the setting is also correctly picked up by the container as can be verified by the output of the powershell command:

     docker run --rm --isolation process --storage-opt size=20G --entrypoint powershell.exe mcr.microsoft.com/windows/servercore:ltsc2022 "Get-PSDrive; Start-Sleep 60"
    
     Name           Used (GB)     Free (GB) Provider      Root                                                                                                                                                                                                                                                 CurrentLocation
     ----           ---------     --------- --------      ----                                                                                                                                                                                                                                                 ---------------
     Alias                                  Alias
     C                   0.12         19.75 FileSystem    C:\
    

Also docker inspect --format "{{ json .HostConfig.StorageOpt }}" reports this:

  {"size":"20G"}
  1. Having the following compose.yaml file:

     services:
       storagetest:
         image: mcr.microsoft.com/windows/servercore:ltsc2022
         isolation: process
         entrypoint:
           - "powershell.exe"
         command:
           - |
             Get-PSDrive
             Start-Sleep 60
         storage_opt:
           size: "20G"
    

I expected that storage-opt would be set on the container just like the example from the command line, but the output shows all the disk size available to the host is also available to the container and docker inspect output does not contain the StorageOpt key at all.

Is this the expected behavior or would it be possible for this to be implemented?

Compose Version

Docker Compose version v2.24.2

Docker Environment

Client:
 Version:    25.0.0
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc.)
    Version:  v2.24.2
    Path:     C:\ProgramData\Docker\cli-plugins\docker-compose.exe

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 10
 Server Version: 25.0.0
 Storage Driver: windowsfilter
  Windows:
 Logging Driver: json-file
 Plugins:
  Volume: local
  Network: ics internal l2bridge l2tunnel nat null overlay private transparent
  Log: awslogs etwlogs fluentd gcplogs gelf json-file local splunk syslog
 Swarm: inactive
 Default Isolation: process
 Kernel Version: 10.0 20348 (20348.1.amd64fre.fe_release.210507-1500)
 Operating System: Microsoft Windows Server Version 21H2 (OS Build 20348.2227)
 OSType: windows
 Architecture: x86_64
 CPUs: 16
 Total Memory: 48GiB
 Name: winsrv01
 ID: b404dc17-d9a0-48f7-b6b7-de17c740e806
 Docker Root Dir: C:\ProgramData\docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions