Skip to content

docker-compose v2 treats environment variables on Windows case-sensitively #12655

@ikedam

Description

@ikedam
  • I have tried with the latest version of Docker Desktop: 4.7.0 (77141)
  • I have tried disabling enabled experimental features
  • I have uploaded Diagnostics
  • Diagnostics ID: 116FD774-2C99-4A8C-BF92-EF80DBC51A71/20220409035537

Actual behavior

PS C:\envTest> type .\docker-compose.yaml
version: '3'
services:
  alpine:
    image: alpine
    environment:
      - envTest
    command:
      - sh
      - -c
      - |
        export|grep envTest
PS C:\envTest> docker-compose -v
Docker Compose version v2.4.1
PS C:\envTest> $ENV:ENVTEST="foobar"
PS C:\envTest> docker-compose run --rm alpine
PS C:\envTest>

Expected behavior

Behavior with docker-compose v1:

PS C:\envTest> type .\docker-compose.yaml
version: '3'
services:
  alpine:
    image: alpine
    environment:
      - envTest
    command:
      - sh
      - -c
      - |
        export|grep envTest
PS C:\envTest> docker-compose -v
docker-compose version 1.29.2, build 5becea4c
PS C:\envTest> $ENV:ENVTEST="foobar"
PS C:\envTest> docker-compose run --rm alpine
Creating envtest_alpine_run ... done
export envTest='foobar'
PS C:\envTest>

also with docker run:

PS C:\envTest> docker -v
Docker version 20.10.14, build a224086
PS C:\envTest> $ENV:ENVTEST="foobar"
PS C:\envTest> docker run --rm -e envTest alpine /bin/sh -c export|findstr envTest
export envTest='foobar'
PS C:\envTest>

Information

  • Windows Version: Windows 10 Pro 21H2 19044.1586 (x64)
  • Docker Desktop Version: 4.7.0 (77141)
  • WSL2 or Hyper-V backend?: WSL2
  • Are you running inside a virtualized Windows e.g. on a cloud server or a VM: No

docker-compose v2 treats environment variables on Windows case-sensitively.
Windows itself treats environment variables case-insensitively
and as far as I tested, docker-compose v1 and docker does so.

This problem is reproducible. No same issue looks reported.

I don't know this problem appears with an update.
I found this when I launched containers using http_proxy/https_proxy environment variables and found it doesn't access to network. I haven't launched them for months and don't know since when this problem appearred.

Output of & "C:\Program Files\Docker\Docker\resources\com.docker.diagnose.exe" check

diagnose-output.txt

Steps to reproduce the behavior

Described above.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions