Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker The source path has too many colons

Tags:

docker

I have run on the Windows command prompt (I have the Linux subsystem for Windows installed):

docker run -d --name privacy-mysql -e MYSQL_ROOT_PASSWORD=DockerPasswort! -e MYSQL_DATABASE=privacy-database -v C:/Users/Alexa/OneDrive/Backend_web_architecture/github_repos/data-privacy-api/db/db_records:/var/lib/mysq"l -v C:/Users/Alexa/OneDrive/Backend_web_architecture/github_repos/data-privacy-api/db/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d" --network privacy-network -dit -p 3306:3306 mysql:latest --default-authentication-plugin=mysql_native_password

This throws:

The source path "/Users/Alexa/OneDrive/Backend_web_architecture/github_repos/data-privacy-api/db/db_records:/var/lib/mysql -v C:/Users/Alexa/OneDrive/Backend_web_architecture/github_repos/data-privacy-api/db/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d"
too many colons.
See 'docker run --help'.

I though the colon at e.g. db_records:/var is necessary? What would I need to fix this?

Thank you for your help!

like image 507
datasciencelearner Avatar asked Apr 16 '20 17:04

datasciencelearner


1 Answers

If you look at the output

A volume mapping is specified as:

  • {locationOnHost}:{locationInsideContainer}

Since the volume you're mapping contains a colon (C:...) - docker will take this as the seperator in the mapping

You can use WSL's wslpath to convert this to a *nix safe path e.g.

wslpath -a 'C:\a\b\ccc\'

results in

/mnt/c/a/b/ccc/

like image 133
Andries Koorzen Avatar answered Sep 30 '22 22:09

Andries Koorzen