Docker Community Forums

Share and learn in the Docker community.

Unable to use volumes with docker compose

Hi,I’ve got a problem running a container with docker compose,

i’ve defined a couple of volumes. with a service like this:

volumes:
   volume1:
        name: volume1
    volume2:
        name: volume2

services:
    service1:
        volumes:
            - "volume1:C:\\Cache"
            - "volume2:C:\\Project"
        platform: windows/amd64
        image: mcr.microsoft.com/windows:1909
        isolation: process
        devices:
            - class/5B45201D-F2F2-4F3B-85BB-30FF1F953599

The host machine is a windows machine also running windows 1909
Docker desktop version: 3.7.1

when running docker-compose run -d --service-ports service1 cmd
I get the following error Error response from daemon: hcsshim::CreateComputeSystem bbf57b3bfc734285102f60b005a3bef8b4e791619867b4cef1eadfd743e66fdb: The request is not supported.

As soon as I remove the volumes section from the service the error goes away.
I tried using docker run with the -v flag and that does seem to work

additionally I tried docker compose V2 but that resulted in the same error,

another thing that does work is specifying a volume like this in the compose file - “sourcePath:TargetPath”

Can anybody tell me what docker compose does differently to a normal docker run command?
thanks in advance.

Can you show how you tried without docker compose?

I have got a similar error message when (using hyperv isolation) I deleted some files manually.

Of course it is not your issue

First I removed all volumes using docker volume prune when no containers were running.
Next I created a volume using docker volume create volume1
Then I started the container using docker run -d -v volume1:C:\Cache --isolation=process --network=transparent-network mcr.microsoft.com/windows:1909

Additonally I would like to mention that I also removed everything except the volumes and still got the message. Since I believe it then defaults to hyperv isolation I don’t think the issue lies there

This is why wrote the same at the end of my previous message. Unfortunately I can’t try it for you with process isolation because there is no Windows 11 compatible image.