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

  • Missing Gemfile when using Docker on Heroku
  • Connect Nginx Docker container to 16 workers
  • Copying file from host to container
  • Docker: Remove and create folder before doing cp
  • Can't download python packages onto Docker image
  • Debug nodejs app inside Docker container
  • 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!

    docker-compose.yml

    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
    

  • Jenkins build an image for Docker?
  • docker attach - turn tty false to tty true
  • How to make docker volume update automatically?
  • Converting a docker-compose file to a build and run command
  • installing PhantomJS on docker/Dokku container
  • How do I run a docker swarm node on the same machine as the swarm manager?
  • 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

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.