Sitespeed.io: Windows sample docker command does not work

Created on 19 Feb 2017  Â·  16Comments  Â·  Source: sitespeedio/sitespeed.io

https://github.com/sitespeedio/sitespeed.io/blob/fbfce714bfb35d7cfd84c2c34c6c59183fc8befe/docs/documentation/sitespeed.io/installation/index.md

In the Windows section there is the sample:

C:\Users\Vicky> docker pull sitespeedio/sitespeed.io
C:\Users\Vicky> docker run --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io https://www.sitespeed.io -b firefox

The second command does not work from the Windows command line:

docker: Error response from daemon: create $(pwd): "$(pwd)" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed.

documentation

Most helpful comment

Looks like in windows command line it's %cd% instead of $(pwd) and in Powershell it's ${PWD}. I can boot up my windows 10 instance and see.

All 16 comments

Hey @gitgrimbo thanks for the bug report! Can you test if this works (found it here https://github.com/dduportal-dockerfiles/docker-compose/issues/1#issuecomment-99464292):

docker run --rm -v  /$(pwd):/sitespeed.io sitespeedio/sitespeed.io https://www.sitespeed.io -b firefox-v

If it works I can update the docs.
Best
Peter

Hi, it's the $(pwd) command that won't work in the Windows command line.

From what I can see, docker (in my case using VirtualBox on Windows) will set up a shared folder to c:\Users\, which can be addressed in the following way:

docker run --rm -v /c/Users/Vicky/sitespeed.io:/sitespeed.io sitespeedio/sitespeed.io https://www.sitespeed.io -b firefox

So the example above will create a c:\Users\Vicky\sitespeed.io folder, and the output is written to there.


Screen shot of docker/VirtualBox shared folders

ok thabks, so lets change docs to have an absolute path!

Looks like in windows command line it's %cd% instead of $(pwd) and in Powershell it's ${PWD}. I can boot up my windows 10 instance and see.

OK nevermind neither of those worked for me. I wonder if there is something like what was needed for docker compose in the last few releases.

export COMPOSE_CONVERT_WINDOWS_PATHS=1

So am I correct that setting an absolute path works? Maybe we can update the docs to that and then later take pwd?

Yep full path works on Windows, but I feel pwd is the standard in terms of examples for Linux and Mac. This seems to only be a windows issue. Maybe a call out to use full path for windows is best?

Hi. This issue was something I noticed on standard Windows command prompt. Maybe it's not an issue for a Windows user using Git Bash or PowerShell - meaning there might be a pwd-like solution on Windows as well.

Yeah I'm pretty sure if you use the docker toolbox command line which is using minGW that using pwd works. I'll double check today if I have time. Personally I think a note in the doc is good enough, so users are aware. I'm sure with Windows adding bash support it will eventually come around. ;-)

@gitgrimbo can you give export MSYS_NO_PATHCONV=1 and then the example with %cd% instead of $(pwd) a try?

Nope, full path on windows doesn't work. Neither of these method works. I've tested -v /c/Users(....):/sitespeed.io , -v c:/Users ... :/sitespeed.io, same goes to "%cd%" etc.

@pats can you share some more info (versions etc)? The example in the docs doesn't work for you? https://www.sitespeed.io/documentation/sitespeed.io/installation/#windows

Best
Peter

my docker version is:
Version 2.0.0.0-win81 (29211)
Channel: stable
Build: 4271b9e

docker run -v /c/Users:/tmp -it ubuntu /bin/bash
docker: Error response from daemon: invalid volume specification: '/c/Users:/tmp'.

the absolute path doesn't work. So only use %cd% work.

the following cmd is ok
docker run --rm -it -v %cd%:/usr/src/project

could you help me to figure out, what`s wrong with my docker.

Hi @ChenLong2014 sorry I don't have Windows instance. @beenanner do you see what's wrong?

Best
Peter

If you are using docker for windows I believe you have to give docker permission to share the drive or something like that or it only allows the home directory. I'll check later today.

my docker version is:
Version 2.0.0.0-win81 (29211)
Channel: stable
Build: 4271b9e

docker run -v /c/Users:/tmp -it ubuntu /bin/bash
docker: Error response from daemon: invalid volume specification: '/c/Users:/tmp'.

the absolute path doesn't work. So only use %cd% work.

the following cmd is ok
docker run --rm -it -v %cd%:/usr/src/project

could you help me to figure out, what`s wrong with my docker.

Can you try docker run -v //c/Users:/tmp:/tmp -it ubuntu /bin/bash

Was this page helpful?
0 / 5 - 0 ratings