Skip to content
Advertisement

Can’t create Docker volume using absolute path on Linux

I’m getting the following error message when trying to run a Docker container with which I want to share some data via a directory (I added the emphasis):

##[error]/usr/bin/docker: Error response from daemon: create -v /opt/vsts/work/1/s/coverage: “-v /opt/vsts/work/1/s/coverage” includes invalid characters for a local volume name, only “[a-zA-Z0-9][a-zA-Z0-9_.-]” are allowed. If you intended to pass a host directory, use absolute path.

What I don’t understand is, that to my knowledge /opt/vsts/work/1/s/coverage is an absolute path, as indicated by the first forward slash.

Can someone explain what I’m doing wrong?

Advertisement

Answer

A build script was passing in “-v /opt/vsts/work/1/s/coverage” as the actual name, i.e.

docker run -v -v /opt/vsts/work/1/s/coverage:[...]

instead of

docker run -v /opt/vsts/work/1/s/coverage:[...].

Thanks @larsks for pointing me in the right direction.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement