Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

V2 env_file: cannot use ENV_VAR=true #1975

@zstadler

Description

@zstadler

Description
When using the following docker-compose.yml file

version: "3.8"
services:
  hello-world:
    image: hello-world
    env_file: .env
    environment:
      ENV_VAR: ${ENV_VAR}

compose version 2 no longer allows the use of the following assignment in an env_file:

ENV_VAR=true

Steps to reproduce the issue:

  1. Unzip env_file_v2.zip in an empty directory
  2. Run docker-compose-v1 config
  3. Run docker compose config

Describe the results you received:
docker compose version 2 fails with the following error:

services.hello-world.environment.ENV_VAR must be a string, number or null

Describe the results you expected:
docker-compose version 1 succeeds with the following output:

services:
  hello-world:
    environment:
      ENV_VAR: "true"
    image: hello-world
version: '3.8'

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker-compose --version:

Docker Compose version v2.0.0-beta.6

Output of docker version:

Docker Compose version v2.0.0-beta.6

Output of docker context show:
You can also run docker context inspect context-name to give us more details but don't forget to remove sensitive content.

[
    {
        "Name": "default",
        "Metadata": {
            "StackOrchestrator": "swarm"
        },
        "Endpoints": {
            "docker": {
                "Host": "unix:///var/run/docker.sock",
                "SkipTLSVerify": false
            }
        },
        "TLSMaterial": {},
        "Storage": {
            "MetadataPath": "\u003cIN MEMORY\u003e",
            "TLSPath": "\u003cIN MEMORY\u003e"
        }
    }
]

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  compose: Docker Compose (Docker Inc., v2.0.0-beta.6)
  scan: Docker Scan (Docker Inc., v0.8.0)

Server:
 Containers: 5
  Running: 0
  Paused: 0
  Stopped: 5
 Images: 18
 Server Version: 20.10.7
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc version: b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.43.3-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 7.703GiB
 Name: docker-desktop
 ID: 2SAP:22SG:T5LD:V6S6:JATD:JQRL:DDNP:6RFG:QZO5:HW3X:JXKT:CI2U
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support

Additional environment details (AWS ECS, Azure ACI, local, etc.):

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussion 💬Discussing usage, best practices, questions, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions