1

My scenario is a virtual machine running windows where I am using docker with linux containers.

My purpose is to launch a sql server container and I am having a hard time to have persistent data.

My question is how to and an explanation if posible of the command run -v to link a host folder with container.

I have read here but I am sorry I dont understand totally. Also docker documentation did not clarify at all.

My attempts failed:

docker create volume sql-data
docker run -v sql-data:C:/temp/

Error response from daemon: invalid mode: /temp/

What I read is a known error but can't find solution nor updated information about the error.

Thanks in advance.

Sam
  • 1,459
  • 1
  • 18
  • 32

1 Answers1

2

Your problem is directly addressed in the docker docs, see here (I recommend you read the Mount volume section in full, it is fairly short). Actually, the docs specifically point out that your syntax will NOT work. To get your command to work, your destination path should be one of the following (from the same link):

a non-existing or empty directory; or a drive other than C:. Further, the source of a bind mount must be a local directory, not a file.

Furthermore, the docs specify:

On Windows, the paths must be specified using Windows-style semantics.

Apply the above statement to your command and it should work. I'm not a windows guy but I would try:

docker run -v sql-data:c:\emptyDir
Perplexabot
  • 1,852
  • 3
  • 19
  • 22
  • thanks for your help. It still doesn't work. Problem is caused by windows path-style you can imagine. Here is the best info I have found. But I am still trying to bring it to my scenario. https://stackoverflow.com/a/52887435/7733724 I will post if I find solution. Thanks :) – Sam Jul 19 '19 at 23:42
  • Did you get an error with the suggested command? Is it the same kind of error in your OP? @Sam ,also is `sql-data` a file or a directory? The docker docs point out that the source must be a dir not a file. – Perplexabot Jul 19 '19 at 23:50
  • 1
    Yes, same error. I tried to change \ for / and upside down, trying to escape characters.. typical stuff. But nop :P Actually I am trying link recomendations and using Kinematic to see if it brings me a bit of light. Thanks – Sam Jul 19 '19 at 23:52