Nag
Nag

Reputation: 2047

What is wrong with this command - docker volume command

What is wrong with this command, I didnt see "demo" in the container . Very weird.

admin@DESKTOP-LLOK073 MINGW64 ~                                                                               
$ winpty docker container run --name test5 -it -v $(pwd)/demo:/demo alpine sh                                 
/ # cd demo                                                                                                   
sh: cd: can't cd to demo: No such file or directory                                                           
/ # ls                                                                                                        
\Program Files\Git\demo  home                     opt                      sbin                     usr       
bin                      lib                      proc                     srv                      var       
dev                      media                    root                     sys                                
etc                      mnt                      run                      tmp                                
/ #    

Upvotes: 1

Views: 69

Answers (1)

Mark
Mark

Reputation: 366

I believe here the program took $(pwd) and get C:\Program Files\Git, then -v interprets $(pwd)/demo:/demo as C:\Program Files\Git\demo:\demo.

Finally, it mounts C in the system to \Program Files\Git\demo in the container, and ignores everything including and after the second :.

Since it looks like that you are using Windows, I recommend that you can just use a Windows version of docker instead of going into MINGW64 and use winpty. After installing docker you should be able to launch docker by opening a terminal window (i.e. a Command Prompt or PowerShell, but not PowerShell ISE) and type:

> docker --version

Upvotes: 2

Related Questions