Skip to content

Inline comments in .envΒ #9025

@zhao-li

Description

@zhao-li

Description
Inline comments in my .env file used to be ignored properly, but now they are getting sucked into docker-compose.yml configurations and is causing errors.

Is this a new feature or the expected behavior going forward? I couldn't find anything new in the documentation.

Thank you for any help or guidance πŸ™

Steps to reproduce the issue:

  1. run docker-compose build

Describe the results you received:
Docker Compose errors out with:

1 error(s) decoding:

* error decoding 'Ports': Invalid containerPort: 8080 # inline comment no longer working

Describe the results you expected:
The container should get built/pulled properly.

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

Output of docker compose version:

Docker Compose version v2.2.1

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.7.1)
  compose: Docker Compose (Docker Inc., v2.2.1)
  scan: Docker Scan (Docker Inc., 0.9.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 25
 Server Version: 20.10.11
 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: 2
 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: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc version: v1.0.2-0-g52b36a2
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.10.76-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 31.36GiB
 Name: docker-desktop
 ID: WX5R:W64V:3QST:M5F3:3U54:K63Y:PGYJ:QPAM:2HSF:JS34:HVYI:RWEJ
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional environment details:
docker-compose.yml:

services:
  app:
    image: nginx
    ports:
      - ${APP_PORT}

.env:

APP_PORT=8080 # inline comment no longer working

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions