Skip to content

[BUG] hcs::CreateComputeSystem error when mounting named volume in a Windows container #12660

@jlrosenlof-kr

Description

@jlrosenlof-kr

Description

I have a problem with mounting named Docker volumes when using Docker CE and Docker Compose on Windows Server 2019. The containers have some volumes defined in their dockerfile. For example, let's say that the line from the dockerfile looks like this:

VOLUME C:\\path\\to\\mount

The container images are based on mcr.microsoft.com/windows/servercore/iis:latest

In my compose files I have been defining the mounts as bind mounts from a local directory in the host (relative to where the compose file is) to the mount path specified in the container. This has been working without any issues.

However, I need to move to using named docker volumes to make the compose files able to be run easily on other developers' computers and also in Docker Swarm. Because of this, I have tried to convert the volume mounts to use named volumes. When I'm trying to do this, though, I'm getting an error message when I run docker-compose up -d:

Error response from daemon: hcs::CreateComputeSystem 20c9b6d58dbc4cf4c5833789f1f51ee3765f4da808d64a7e509e5d7ca2bb3a0b: The request is not supported.

The Application event log also has this Event Id 11 from docker:

Handler for POST /v1.48/containers/2aaae6f88e8a284db14e8cdfb749924520f9252fcf6f697dd8c95e26fdd75a78/start returned error: hcs::CreateComputeSystem 2aaae6f88e8a284db14e8cdfb749924520f9252fcf6f697dd8c95e26fdd75a78: The request is not supported. [traceID=fc15cc99447aa316741fe1e406a0ad8c spanID=afb829837595bb4d]

The number changes but the text is always the same.

Here is a snippet of my compose file:

name: test_appstack

services:
  myservice:
    image: myregistry/myapp/image:1.0.0.0
    volumes:
      # This is the way I used to be doing it
      #- ".\\websiteDeployFolder\\:C:\\path\\to\\mount:rw"
      # This doesn't work; error
      #- "website_deployfolder:C:/path/to/mount"
      # This doesn't work; error
      #- "website_deployfolder:C:\\path\\to\\mount:ro"
      # It works when I mount to a folder that is NOT specified as a VOLUME in the dockerfile
      #- "dw_deploy:C:\\Users\\ContainerAdministrator\\Downloads"
      #This doesn't work either; error.
      - type: volume
        source: dw_deploy
        target: C:/path/to/mount
        volume:
          nocopy: true
    environment:
      DBHost: "host name here"
      DBPort: "port here"
      UseSN: "Y"
      DBIdentifier: "db info here"
      DBUserName: "db user here"
      DBPassword: "db pw here"
    networks:
      - appstack-net

  ...other services here...

networks:
  appstack-net:
    driver: nat

volumes:
  # I've tried using an external volume...
  website_deployfolder:
    external: true
  # ...and a non-external volume
  dw_deploy:

I have tried lots of different combinations of things to get this to work. A couple notable things that I found:

  • When I do the same type of mount with docker run it works and doesn't throw an error:
    • docker run --rm --env-file envVars.env -v website_deployfolder:C:/path/to/mount -p 8000:80 myregistry/myapp/image:1.0.0.0
  • When I do a mount to some other directory (not a directory specified by VOLUME in the dockerfile) it works:
    • Under the service's volumes tag: - "dw_deploy:C:\\Users\\ContainerAdministrator\\Downloads"

Steps To Reproduce

  1. Create a container image with a volume, e.g. VOLUME C:\\path\\to\\mount
  2. In a compose file, in the top-level volumes statement, define a volume. It can be either a compose-managed volume or an external volume.
  3. In the compose file, under the service definition, define a volume mount which mounts the named volume from step 2 to the directory in the container named in step 1. The mount can use either the long form or short form syntax.
  4. Run docker-compose -f compose.yaml up -d
  5. Get error: Error response from daemon: hcs::CreateComputeSystem 20c9b6d58dbc4cf4c5833789f1f51ee3765f4da808d64a7e509e5d7ca2bb3a0b: The request is not supported.
  6. Run docker-compose -f compose.yaml down -v

Try running it with docker to verify that the volume mount works outside of docker compose

  1. Create a Docker volume: docker volume create testVolume
  2. Run the container with docker run: docker run --rm --env-file envVars.env -v testVolume:C:/path/to/mount -p 8000:80 myregistry/myapp/image:1.0.0.0
  3. The mount works successfully. This can be verified by connecting to the container and creating and deleting files.

Try using docker compose to mount to a directory inside the container that is not specified as a VOLUME in the dockerfile.

  1. Pick a directory inside of the container to mount to.
    • Most windows containers based on servercore have user directories so you can pick something under there like: C:\Users\ContainerAdministrator\Downloads
  2. Create a Docker volume: docker volume create testVolume
  3. In the compose.yaml file, define a volume in the top-level volumes statement:
    •       volumes:
                testVolume:
                    external: true
      
  4. In the compose.yaml file, define the volume mount in the service's volumes statement:
    •       volumes:
                - "testVolume:C:\\Users\\ContainerAdministrator\\Downloads"
      
  5. Run `docker-compose -f compose.yaml up -d
  6. Mount works successfully. This can be verified by connecting to the container and creating and deleting files.

Compose Version

$> docker-compose version
Docker Compose version v2.33.1

Docker Environment

$> docker info
Client:
 Version:    28.0.0
 Context:    default
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 218
 Server Version: 28.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: active
  NodeID: cbbjouk5beftga3uxf36arlya
  Is Manager: false
  Node Address: <local ip obscured>
  Manager Addresses:
   <local ip obscured>:2377
 Default Isolation: process
 Kernel Version: 10.0 17763 (17763.1.amd64fre.rs5_release.180914-1434)
 Operating System: Microsoft Windows Server Version 1809 (OS Build 17763.7009)
 OSType: windows
 Architecture: x86_64
 CPUs: 4
 Total Memory: 4.999GiB
 Name: <host name obscured>
 ID: dd1ab9bd-f68d-447d-ae4f-2c5e92f16c16
 Docker Root Dir: C:\ProgramData\docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions