Skip to content

Error "Invalid template" parsing .env file #9746

Closed
@alejgr

Description

@alejgr
  • I have tried with the latest version of Docker Desktop
  • I have tried disabling enabled experimental features
  • I have uploaded Diagnostics
  • Diagnostics ID: 795F330D-B823-4025-9550-703A3E38857E/20220812105351

Expected behavior

docker compose works as expected

Actual behavior

Error:
Invalid template: "^https?://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?$"

Information

  • macOS Version: Monterey 12.5
  • Intel chip or Apple chip: Apple chip (M1)
  • Docker Desktop Version: 4.11.1

Output of /Applications/Docker.app/Contents/MacOS/com.docker.diagnose check

Starting diagnostics

[PASS] DD0027: is there available disk space on the host?
[PASS] DD0028: is there available VM disk space?
[PASS] DD0031: does the Docker API work?
[PASS] DD0004: is the Docker engine running?
[PASS] DD0011: are the LinuxKit services running?
[PASS] DD0016: is the LinuxKit VM running?
[PASS] DD0001: is the application running?
[PASS] DD0018: does the host support virtualization?
[PASS] DD0017: can a VM be started?
[PASS] DD0015: are the binary symlinks installed?
[PASS] DD0003: is the Docker CLI working?
[PASS] DD0013: is the $PATH ok?
[PASS] DD0007: is the backend responding?
[PASS] DD0014: are the backend processes running?
[PASS] DD0008: is the native API responding?
[PASS] DD0009: is the vpnkit API responding?
[PASS] DD0010: is the Docker API proxy responding?
[PASS] DD0012: is the VM networking working?
[PASS] DD0032: do Docker networks overlap with host IPs?
[SKIP] DD0030: is the image access management authorized?
[PASS] DD0019: is the com.docker.vmnetd process responding?
[PASS] DD0033: does the host have Internet access?
No fatal errors detected.

Steps to reproduce the behavior

I am using a sample docker-compose file like this:

services:
  hello:
    container_name: hello-world
    image: hello-world

Also I have this .env file in the same directory:

CORS_ALLOW_ORIGIN=^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$

As you can see, .env file is not used in docker-compose.yaml, but when I run any docker compose command, the error above is thrown.

.env file is used by another application. If I rewrite it as follows (two $ at the end), then it works for docker compose, but this is not the correct value I want to have.

CORS_ALLOW_ORIGIN=^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$$

Why is docker-compose forcing me to change this .env file?

Metadata

Metadata

Assignees

No one assigned

    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