Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Compose says $PWD variable not set Windows

I am new to docker. I currently have docker-compose.yml where volume I want to mount my current directory to '/usr/share/data' in the container. So something like:

volumes:
    - ${PWD}/data:/usr/share/data/

I am using windows with a Linux Subsystem and want to know why isn't it able to get the PWD variable. The same code on a Linux machine works fine. Please tell me how to set the environment PWD. Do I need to do it manually or can i do it using the same docker-compose file. Using . instead of ${PWD} gives no directory error and I have seen many forums saying that it is a windows problem.

like image 508
A.Hamza Avatar asked May 27 '26 23:05

A.Hamza


1 Answers

You need to use ${PWD} instead of {$PWD}. You can also use dot . instead of ${PWD}.

like image 136
anemyte Avatar answered May 31 '26 07:05

anemyte