Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a docker-compose "Getting Started" example causes "Invalid volume specification" on Windows

Tags:

I am absolutely new to Docker. I followed steps described in Docker Compose's "Getting Started" tutorial:

  1. Install Docker Toolbox
  2. Start Docker Quickstart Terminal
  3. Add project files
  4. Run docker-compose up command

And I got following error:

ERROR: for web  Cannot create container for service web: Invalid bind mount spec "D:\\Projects\\composetest:/code:rw": Invalid volume specification: 'D:\Projects\composetest:/code:rw' [31mERROR[0m: Encountered errors while bringing up the project. 

docker-compose.yml:

version: '2' services:   web:     build: .     ports:      - "5000:5000"     volumes:      - .:/code:rw   redis:     image: "redis:alpine" 

Project structure:

D:\Projects\composetest   ├── app.py   ├── docker-compose.yml   ├── Dockerfile   └── requirements.txt 

My configuration:

  1. Windows 10 Single Language
  2. Docker Toolbox 1.12.5

Why does it happen? Is there some workaround?

like image 401
Lodin Avatar asked Dec 25 '16 02:12

Lodin


People also ask

What happens when you run Docker compose up?

The docker compose up command aggregates the output of each container (like docker compose logs --follow does). When the command exits, all containers are stopped. Running docker compose up --detach starts the containers in the background and leaves them running.

Does Docker compose create volumes?

We can also create a volume and then use it with a container using the -v flag. Docker-compose allows us to use volumes that are either existing or new.

What is Docker_cert_path?

“DOCKER_CERT_PATH” contains the location of the client configuration files used for TLS verification.


1 Answers

I found the solution. The problem was I didn't set the environment variable COMPOSE_CONVERT_WINDOWS_PATHS. It is described in the CLI variables doc.

So, if this problem exists, you should create new Windows environment variable called COMPOSE_CONVERT_WINDOWS_PATHS and set it to 1. Or you can create .env file in the path docker-compose.yml is placed with following content:

 COMPOSE_CONVERT_WINDOWS_PATHS=1 

It will solve this problem.

like image 174
Lodin Avatar answered Sep 24 '22 11:09

Lodin