I am absolutely new to Docker. I followed steps described in Docker Compose's "Getting Started" tutorial:
docker-compose up
commandAnd 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:
Why does it happen? Is there some workaround?
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.
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.
“DOCKER_CERT_PATH” contains the location of the client configuration files used for TLS verification.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With