I'm using a Windows container on a windows host and I get an error when using docker-compose and specify a volume mount. The error occurs after the container is built and the container is attempting to start (docker-compose up
):
[+] Running 2/0
- Volume "myvol" Created 0.0s
- Container docker-myservice-1 Created 0.1s
Attaching to docker-myservice-1
Error response from daemon: hcsshim::CreateComputeSystem d0f7071018af7fe5e978c3daac2945a47ff11705291efecd76eb9a4e15b40715: The request is not supported.
Here is my docker-compose.yaml
file:
services:
myservice:
build: .
image: myimage:latest
ports:
- "80:80"
volumes:
- type: volume
source: myvol
target: C:\mydir
# these dont work either.
# target: "C:\\mydir"
# target: C:/mydir
# target: //c/mydir
# target: //c/mydir
volumes:
myvol:
name: myvol
Removing services.myservice.volumes creates a running container, so its something to do with that.
I'm pretty sure that I dont have the target format correct, and I also made sure to add the COMPOSE_CONVERT_WINDOWS_PATHS=1
as per ERROR - Docker-compose/docker Windows.
Strangely enough, the following works as intended using docker only:
docker build . -t myimage:latest
docker run -dp 80:80 --mount "source=myvol,target=C:\mydir" myimage:latest
What is the correct volume format to use in docker-compose.yaml
? Or are there other mistakes I've made?