Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.env overwrites other env file variables if existing #9683

Closed
mikoyats opened this issue Jul 28, 2022 · 0 comments · Fixed by #9636
Closed

.env overwrites other env file variables if existing #9683

mikoyats opened this issue Jul 28, 2022 · 0 comments · Fixed by #9636
Assignees

Comments

@mikoyats
Copy link

Description

Steps to reproduce the issue:

  1. Create two env files

.env

FOO=OVERWRITE

test.env

FOO=ORIGINAL
BAR=ORIGINAL
  1. Create docker-compose.yml
version: '3'

services:
  test1:
    container_name: test1
    image: node
    env_file: test.env
    command: env
  1. Run docker-compose up

Describe the results you received:
Received the env variables:

test1  | NODE_VERSION=18.7.0
test1  | HOSTNAME=54379d4daed7
test1  | YARN_VERSION=1.22.19
test1  | HOME=/root
test1  | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
test1  | BAR=ORIGINAL
test1  | FOO=OVERWRITE
test1  | PWD=/

Describe the results you expected:

test1  | NODE_VERSION=18.7.0
test1  | HOSTNAME=54379d4daed7
test1  | YARN_VERSION=1.22.19
test1  | HOME=/root
test1  | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
test1  | BAR=ORIGINAL
test1  | FOO=ORIGINAL
test1  | PWD=/

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

Output of docker compose version:

Docker Compose version v2.6.1

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.6.1)
  extension: Manages Docker extensions (Docker Inc., v0.2.7)
  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: 52
  Running: 40
  Paused: 0
  Stopped: 12
 Images: 121
 Server Version: 20.10.17
 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.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc version: v1.1.2-0-ga916309
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.10.104-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 10
 Total Memory: 15.64GiB
 Name: docker-desktop
 ID: P7XW:OVJL:ISLJ:FAOU:H3LF:T4VR:E5CP:UIR5:QKHA:ODYR:NDPA:WRHZ
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5000
  127.0.0.0/8
 Live Restore Enabled: false

Additional environment details:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants