Skip to content

[BUG] The PWD environment variable will always be overwritten #13265

@countzero

Description

@countzero

Description

With f38f3f7 the environment variable PWD will always be overwritten with the parent working directory using the Go function https://pkg.go.dev/os#Getwd.

This might be OK in 99% of all use cases, but this change breaks a special use case:

I need to set the PWD variable differently to match another directory structure within a VM that actually runs the Docker daemon. e.g. a Windows host system and a Debian guest system. The CLI tools docker with the docker compose plugin are installed on the Windows host and access the Docker daemon on the Debian guest. Directories are synced from the Windows host to the Debian host and therefore have another parent working directory in the context of the VM

Suggestion: Please check if a PWD environment variable is present and only if it is not set it to the result of os.Getwd(). That is a defensive programming technique and will satisfy both use cases.

This defect has been introduced with https://github.com/docker/compose/releases/tag/v2.35.0 with v2.34.0 it is still possible to set a specific PWD variable.

Steps To Reproduce

No response

Compose Version


Docker Environment


Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions