0

I start a docker linux container on windows 10 and I use -v D:\workspace:/home/work/workspace to map the disk into the container, by which I can persist my linux workspace. Then I ran mkdir /home/work/workspace/aux in the container but I failed because the directory aux is not able to be created on windows.

So Anybody can help me?

GOGO
  • 619
  • 2
  • 7
  • 17
  • You can't. Or at least, you can't do it in a directory that's mounted from the host filesystem. – hobbs Feb 02 '20 at 05:59
  • What error are you getting? It could be because inside the container you're user `root` and the Windows host won't allow that user to write to the host filesystem. – root Feb 02 '20 at 07:17
  • Can I make a Linux volume on windows only used by docker linux container? – GOGO Feb 02 '20 at 07:19
  • @root It is not because the user is `root`. It failed because the directory `aux` is not able to be created on windows. – GOGO Feb 02 '20 at 07:20
  • What is the error message? Is it literally "the directory aux is not able to be created on windows"? – root Feb 02 '20 at 07:23
  • 1
    Does this answer your question? [Cannot create a directory named "Aux" or starting by "Aux." on Windows 8.1](https://stackoverflow.com/questions/36225708/cannot-create-a-directory-named-aux-or-starting-by-aux-on-windows-8-1) – Daniel Mann Feb 02 '20 at 07:32
  • While CMD has poor support for device paths (i.e. paths that start with "\\?\" and "\\.\"), it supports them in a few cases, such as basic file operations. You can create a file/directory with a reserved DOS name (i.e. names with DOS devices or trailing spaces and dots) using a non-normalized device path (i.e. an extended path) that begins with the "\\?\" prefix. The path must be fully qualified, e.g. `mkdir \\?\D:\workspace\aux`. However, I highly recommend against this because the shell and most programs do not support it, plus DOS device names are disallowed by the SMB server in UNC paths. – Eryk Sun Feb 02 '20 at 15:34
  • Using an extended path is more useful for removing a directory/file that has a reserved name, e.g. `rmdir /q /s \\?\D:\workspace\aux`. Unfortunately CMD's `rename` command doesn't support extended paths, but PowerShell does, e.g. `pwsh -c "rename-item \\?\D:\workspace\aux spam"`. – Eryk Sun Feb 02 '20 at 15:47
  • The situation is I just run the command `tar -zxf libunwind.tar.gz` in the docker container. And `aux` is a subdirectory of the uncompressed directory. As a result, the command failed. So what should I do? – GOGO Feb 03 '20 at 08:49
  • 1
    It's pretty clear that Docker is either directly or indirectly enforcing DOS naming rules here, which is fine. I'm not a Docker user, but if it has to be persisted in this workspace directory, which has to be a native Windows directory, can you create and mount a virtual disk in the workspace directory for cases where you need native Linux file naming and permissions? – Eryk Sun Feb 03 '20 at 17:33
  • Your advise is very good.@ErykSun Can you recommend some tools to create a virtual linux disk on my windows? – GOGO Feb 04 '20 at 13:40

0 Answers0