You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to get an application running with docker compose up that relies on environment variables that are set in a .env file. Anytime I attempt to use a .env file however, I get the error 'unexpected character "»" in variable name near "\ufeffENVIRONMENTVAR1=myvalue"'. I have gone so far as to make the .env file completely empty and this same error still occurs.
run docker compose up from an administrator powershell window
Describe the results you received:
Docker compose appears to be failing to parse the .env file for a character that does not exist. I have triple checked that there is no hidden unicode characters in the file, and the failure occurs even on totally empty .env files.
Describe the results you expected:
The environment variables would be parsed from the file and used in the same way that docker run --env-file .env <image> uses them.
Additional information you deem important (e.g. issue happens only occasionally):
Output of docker compose version:
Docker Compose version v2.9.0
Output of docker info:
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.8.2)
compose: Docker Compose (Docker Inc., v2.9.0)
extension: Manages Docker extensions (Docker Inc., v0.2.8)
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
scan: Docker Scan (Docker Inc., v0.17.0)
Server:
Containers: 31
Running: 0
Paused: 0
Stopped: 31
Images: 205
Server Version: master-dockerproject-2022-03-26
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: ics internal l2bridge l2tunnel nat null overlay private transparent
Log: awslogs etwlogs fluentd gcplogs gelf json-file local logentries splunk syslog
Swarm: active
NodeID: qtua9l1p2l9halezs4l0ae6uv
Is Manager: true
ClusterID: ua8jix4r9tihua2fo75pblyb6
Managers: 1
Nodes: 1
Default Address Pool: 10.0.0.0/8
SubnetSize: 24
Data Path Port: 4789
Orchestration:
Task History Retention Limit: 5
Raft:
Snapshot Interval: 10000
Number of Old Snapshots to Retain: 0
Heartbeat Tick: 1
Election Tick: 10
Dispatcher:
Heartbeat Period: 5 seconds
CA Configuration:
Expiry Duration: 3 months
Force Rotate: 0
Autolock Managers: false
Root Rotation In Progress: false
Node Address: 192.168.58.4
Manager Addresses:
192.168.58.4:2377
Default Isolation: process
Kernel Version: 10.0 17763 (17763.1.amd64fre.rs5_release.180914-1434)
Operating System: Microsoft Windows Server Version 1809 (OS Build 17763.737)
OSType: windows
Architecture: x86_64
CPUs: 2
Total Memory: 16GiB
Name: DEV01
ID: BX6Y:OQBU:JRIL:W4A6:X6O2:77H5:I3BJ:KUMB:PR33:SICG:OHB5:ZXZF
Docker Root Dir: C:\ProgramData\docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
Additional environment details:
The Windows Server 2019 instance I am running docker in is a VM on a Windows 10 host machine. Other operations with running containers directly, or using compose files that do not rely on environment files works fine.
The text was updated successfully, but these errors were encountered:
I could not reproduce just by creating an empty .env file.
But I did reproduce it this way :
$ python3 -c 'with open(".env", "wb") as file: file.write(bytes("\uFEFF", "utf-8"))'
$ docker compose --env-file .env up
unexpected character "»"in variable name near "\ufeff"
Notably, (U+FEFF) is the famous "Zero Width No-Break Space" which is known for breaking things.
But like you said :
I have triple checked that there is no hidden unicode characters in the file, and the failure occurs even on totally empty .env files.
So I don't know ...
Some Windows editors tend to add UTF-8 BOM markers to files,
which breaks parsing of `.env` files.
Now, when the file is read, if it starts with a UTF-8 BOM,
we'll skip it. (`.env` files are always processed as UTF-8.)
See docker/compose#9799.
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Description
I am trying to get an application running with
docker compose up
that relies on environment variables that are set in a .env file. Anytime I attempt to use a .env file however, I get the error 'unexpected character "»" in variable name near "\ufeffENVIRONMENTVAR1=myvalue"'. I have gone so far as to make the .env file completely empty and this same error still occurs.Steps to reproduce the issue:
docker compose up
from an administrator powershell windowDescribe the results you received:
Docker compose appears to be failing to parse the .env file for a character that does not exist. I have triple checked that there is no hidden unicode characters in the file, and the failure occurs even on totally empty .env files.
Describe the results you expected:
The environment variables would be parsed from the file and used in the same way that
docker run --env-file .env <image>
uses them.Additional information you deem important (e.g. issue happens only occasionally):
Output of
docker compose version
:Output of
docker info
:Additional environment details:
The Windows Server 2019 instance I am running docker in is a VM on a Windows 10 host machine. Other operations with running containers directly, or using compose files that do not rely on environment files works fine.
The text was updated successfully, but these errors were encountered: