-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Description
Hey!
docker compose --env-file=file.env up is ignoring the --env-file option.
Steps To Reproduce
- have a
docker-compose.yamlfile that should use some environment variables from an environment variables file.
example:
version: '3.9'
services:
node:
image: node:18
container_name: live_dev
# it was specifically chosen to hang the container so that we can inspect it
command: tail -F anything- have an
file.envfile:
example:
MY_VAR=my_var
- have the following directory structure:
[~/live_dev] $ tree -a
.
├── docker-compose.yaml
└── file.env
1 directory, 2 files- run the
docker compose --env-file=file.env up - enter the container via
docker exec -it live_dev /bin/bash - run
printenvto see ifMY_VARexists
[~/live_dev] $ docker exec -it live_dev /bin/bash
root@741ec06639ca:/# printenv
HOSTNAME=741ec06639ca
YARN_VERSION=1.22.19
PWD=/
HOME=/root
TERM=xterm
SHLVL=1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
NODE_VERSION=18.17.0
_=/usr/bin/printenv
- notice that
MY_VARdoesn't exist
Compose Version
Docker Compose version v2.18.1
Docker Environment
Client: Docker Engine - Community
Version: 24.0.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.11.1
Path: /usr/lib/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.18.1
Path: /usr/lib/docker/cli-plugins/docker-compose
Server:
Containers: 4
Running: 4
Paused: 0
Stopped: 0
Images: 14
Server Version: 24.0.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
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 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 0cae528dd6cb557f7201036e9f43420650207b58
runc version: 5fd4c4d144137e991c4acebb2146ab1483a97925
init version: 0b44d36
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.3.12-241.current
Operating System: Solus 4.4 Harmony
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 15.5GiB
Name: catalin
ID: QGPZ:6HOM:HUOC:EWS6:42UO:UZ47:5PEO:NKUW:VUDH:LQQ7:GI5X:RAY6
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Anything else?
Adding env_file to the docker-compose.yaml and running docker compose up loads the file and makes the variable present.
version: '3.9'
services:
node:
image: node:18
env_file:
- file.env
container_name: live_dev
# it was specifically chosen to hang the container so that we can inspect it
command: tail -F anythingDid some investigation and it seems it was removed from build, up and down some time ago(maybe in the Python version and got ported to the Go version, I am not sure). #6800 and also has something to do with #10650
I don't know if this is supposed to happen.
Jhoyola, sterliakov and alanchen222