docker invalid characters for local volume name
A few days ago, I installed docker on my new laptop. I’ve used docker for a while and know the basics pretty well. Yet, for some reason I keep bumping into the same problem and I hope someone here can help me.
After installing the Docker Toolbox on my Windows 10 Home laptop, I tried to run some images that I’ve created using a docker-compose.yml. Since my user directory on windows has my exact name in it (C:/Users/Nick van der Meij) and that name contains spaces, I added an extra shared folder from C:/code to /mnt/code on the Docker Host (this works). I’ve used this guide to do so
However, when I try to run my docker-compose.yml (included below), I get the following error:
ERROR: for php Cannot create container for service php: create \mnt\code\basic_php\api: "\\mnt\\code\\basic_php\\api" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed [31mERROR[0m: Encountered errors while bringing up the project.
As far as I see it, everything seems to be correct according to the official docker docs about volumes. I’ve spend many hours trying to fix this and tried out multiple “formats” for the volumes tag, yet without any success.
Does anyone know what the problem might be?
Thanks in Advance!
version: '2' services: mysql: image: mysql:5.7 ports: - 3306 volumes: - /var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: password MYSQL_USER: user MYSQL_PASSWORD: password MYSQL_DATABASE: database nginx: image: nginx:1.10.2 ports: - 80:80 - 443:443 restart: always volumes: - /mnt/code/basic_php/nginx/conf:/etc/nginx/conf.d - /mnt/code/basic_php/api:/code/api - /mnt/code/basic_php/nginx:/code/nginx links: - php - site depends_on: - php - site php: build: php expose: - 9000 restart: always volumes: - /mnt/code/basic_php/php/conf/php.ini:/usr/local/etc/php/conf.d/custom.ini - /mnt/code/basic_php/api:/code/api links: - mysql site: restart: always build: site ports: - 80 container_name: site
One Solution collect form web for “docker invalid characters for local volume name”
After a few hours searching the web, I finally found what i was looking for. Like Wolfgang Blessen said in the comments below my question, the problem was indeed a Windows Path problem.
If you dont want docker to automatically convert paths windows to unix, you need to add the COMPOSE_CONVERT_WINDOWS_PATHS environment variable with a value of 0 like explained here: link