Open MartinsSmirnovs opened 2 years ago
Can you use .
instead? You are right, PWD
is set by the shell.
You are correct, for this particular case .
could work instead of PWD
, however note that difference between these two is that .
is relative path to file where it is located, but PWD
is absolute path to directory from which you call command. I have a project where I have two Compose files - one in same directory from which I call Compose command and second one is buried under some nested directories. The second file needs PWD
, because it needs path from where the command was called, not to itself.
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 10 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
:slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
I have moved to Docker Compose V2 and now Remote Containers fail to start my services using
docker-compose
(see Logs). The issue looks similar to #5992, however turns out that the root cause is different. Before remote Containers starts services, it performsdocker-compose config
to check that compose files are valid. If we use example repo from "Steps to reproduce" section and rundocker-compose config
on it, the command will be executed successfully with both Compose V1 and Compose V2, but if we let Remote Containers do it, it will be successful with Compose V1 only. The reason for failure is here:With Compose V2, Remote Containers
docker-compose config
fails because it fails to expandPWD
environment variable. There is no such error when we perform the command manually, because, unlike Remote Containers which executes passed command directly without a shell, bash expands the variable and we get expected result. As a workaround we can use Compose default variable substitution as can be seen in commented line under#For Compose V2
. My guess is that Remote Containers executes commands for Compose V1 and V2 differently, which makes inconsistent results and problems like this that are difficult to debug.Steps to Reproduce:
>Remote-Containers: Open Folder in Container