Docker Community Forums

Share and learn in the Docker community.

Docker-compose on Windows "invalid volume spec"


(Gspinell) #1

I have a database that gets created in C:\app in the container. I want to map that to a local file in C:\dockerstuff on my Windows 2016 server host, what is the correct syntax for the “volumes:” attribute in my yaml file?

I have tried every possible combination I could think of and they all fail with some variation of “invalid volume spec”. When I comment out the “volumes” attribute, I can see mydatabase.db in the container in the C:\app directory.

Host: Windows 2016 Server Standard
Docker: 17.06.2-ee-16, build 9ef4f0a
Docker-compose: 1.23.0-rc1, build 320e4819

Here’s my yaml file.

version: ‘3.6’

services:

test:
hostname: test
environment:
- ASPNETCORE_ENVIRONMENT=ProductionDocker
- ASPNETCORE_URLS=http://+:80
- DB__Type=litedb
- DB__File=mydatabase.db
- COMPOSE_CONVERT_WINDOWS_PATHS=1
image: testreg.io/testwin:latest
ports:
- “8081:80”
volumes:
- c:\dockerstuff:c:\app


(Martinkelley) #2

I have multiple containers that use SQL and I get SQL to use volume on host
sql:
_ image: “microsoft/mssql-server-linux”_
_ container_name: sql_
_ environment:_
_ SA_PASSWORD: ${SQLUSERPASS}_
_ ACCEPT_EULA: “Y” _
_ ports:_
_ - “1402:1433”_
_ volumes:_
_ - sqlvolume:/var/opt/mssql_
_ networks:_
_ - poc_network_

plus (at root level)
volumes:
_ sqlvolume:_
_ name: sqldata_