docker-compose reference YAML file with comments
source link: https://gist.github.com/ju2wheels/1885539d63dbcfb20729
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
docker-compose reference YAML file with comments · GitHub
Instantly share code, notes, and snippets.
My host files are in Windows 10 and file names contain spaces. For the life of me I can't figure out how to use quotes so that I could specify a mapping of:
"D:/my files" : /var
Please update documentation to specify how to handle spaces in file names
Author
@djmarcus1 see the official documentation, use the long syntax form for volumes available with docker-compose v2.3 or later:
https://docs.docker.com/compose/compose-file/compose-file-v2/#long-syntax . This reference file was more for v1 docker-compose format I believe, I wrote it a while ago.
Thank you for the link.. but I'm still running into issues. I want to map "D:/MyFolder" (on my Windows machine) to "/MyFolder" in the Docker image.
docker-compose keeps complaining.
For the yml file below, this is the complaint I get:
ERROR: The Compose file '.\docker-compose.yml' is invalid because:
Unsupported config option for services.volumes: 'D:/MyFolder'
I appreciate any quick help.
My yml file is:
services:
tseLogger:
image: tselogger-2-3-0-6
ports: [42949]
command: -port 42949 -platform Production
tseShard0:
image: tseshard-2-3-0-6
ports: [52949]
volumes:
- type: volume
source: "D:/MyFolder"
target: /MyFolder
volume:
nocopy: true
command: -dataPath "/MyFolder/Data/DbCache" -platform Production -shardId 0 -shardsCount 2 -allMongoUpdates false -logger "127.0.0.1:42949" -shard0 "127.0.0.1:52949" -shard1 "127.0.0.1:52950" -loadENV "/MyFolder/Config.json"
tseShard1:
image: tseshard-2-3-0-6
ports: [52950]
volumes:
- type: volume
source: "D:/MyFolder"
target: /MyFolder
volume:
nocopy: true
command: -dataPath "/MyFolder/Data/DbCache" -platform Production -shardId 1 -shardsCount 2 -allMongoUpdates false -logger "127.0.0.1:42949" -shard0 "127.0.0.1:52949" -shard1 "127.0.0.1:52950" -loadENV "/MyFolder/Config.json"
volumes:
"D:/MyFolder":
Author
@djmarcus1 that seems like its Docker for Windows related nonsense for sharing drives whether its Hyperv or WSL, see doc here: https://docs.docker.com/docker-for-windows/#shared-drives . I cant answer further as I dont use Windows as at all so ive never run into this issue.
Thank for your help... turns out the problem was the outer 'volumes:' had to be un-indented (start at the same column as 'services').
So basically, the error message provided no clue on how to remedy ..
This issue can be closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK