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

[BUG] 2.28.1 multiple COMPOSE_* vars no longer read from .env file #11967

Closed
ShadowLNC opened this issue Jul 5, 2024 · 0 comments · Fixed by #11974
Closed

[BUG] 2.28.1 multiple COMPOSE_* vars no longer read from .env file #11967

ShadowLNC opened this issue Jul 5, 2024 · 0 comments · Fixed by #11974

Comments

@ShadowLNC
Copy link

ShadowLNC commented Jul 5, 2024

Description

It seems like Compose is inconsistently reading the .env file for COMPOSE_* variables.

In 2.27.1 we had #11856 and #11955 where COMPOSE_PROFILES was ignored.

According to the docs, I would expect all of the COMPOSE_* variables to be respected when placed in .env (or other file as specified by --env-file).

Variable 2.27.0 2.27.1 2.28.1
COMPOSE_PROFILES
COMPOSE_ANSI ?
COMPOSE_REMOVE_ORPHANS ℹ️ ?
COMPOSE_IGNORE_ORPHANS ? ?

ℹ️ In 2.27.0, COMPOSE_REMOVE_ORPHANS in an .env file only worked during compose up and not during compose down.

Steps To Reproduce

docker-compose.yml

services:
    test1:
        image: nginx:alpine
        healthcheck:
            test: "wget -q -O - http://localhost:80/ || exit 1"
        profiles:
            - one
    test2:
        image: nginx:alpine
        healthcheck:
            test: "wget -q -O - http://localhost:80/ || exit 1"
        profiles:
            - two

.env

COMPOSE_REMOVE_ORPHANS='1'
COMPOSE_ANSI='never'
COMPOSE_PROFILES='*'

For COMPOSE_ANSI, simply run compose up and see it's back to using the dynamic formatting.

For COMPOSE_REMOVE_ORPHANS, run compose up and then comment out the test2 service. Running compose down wouldn't destroy test2 in 2.27.0 but compose up did.

In 2.28.1 you get the warning about orphans on compose up (which can be suppressed by specifying COMPOSE_IGNORE_ORPHANS=1), but it doesn't remove them. (There is also no warning on compose down except for the network remaining in use, and perhaps there should be an explicit note about orphans.)

Compose Version

docker-compose is no longer present on my system (perhaps this should be removed from the template prompt?)

$ docker compose version
Docker Compose version v2.28.1-desktop.1

Docker Environment

docker info
Client:
 Version:    27.0.3
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.15.1-desktop.1
    Path:     /Users/scott/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.28.1-desktop.1
    Path:     /Users/scott/.docker/cli-plugins/docker-compose
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.0.32
    Path:     /Users/scott/.docker/cli-plugins/docker-debug
  desktop: Docker Desktop commands (Alpha) (Docker Inc.)
    Version:  v0.0.14
    Path:     /Users/scott/.docker/cli-plugins/docker-desktop
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.2
    Path:     /Users/scott/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.25
    Path:     /Users/scott/.docker/cli-plugins/docker-extension
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  v1.0.5
    Path:     /Users/scott/.docker/cli-plugins/docker-feedback
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.3.0
    Path:     /Users/scott/.docker/cli-plugins/docker-init
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /Users/scott/.docker/cli-plugins/docker-sbom
  scout: Docker Scout (Docker Inc.)
    Version:  v1.10.0
    Path:     /Users/scott/.docker/cli-plugins/docker-scout

Server:
 Containers: 30
  Running: 20
  Paused: 0
  Stopped: 10
 Images: 94
 Server Version: 27.0.3
 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: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: ae71819c4f5e67bb4d5ae76a6b735f29cc25774e
 runc version: v1.1.13-0-g58aa920
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
  cgroupns
 Kernel Version: 6.6.32-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 8
 Total Memory: 7.755GiB
 Name: docker-desktop
 ID: 85b60fc6-eedd-4b8c-996a-89f62a45ab85
 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
 Labels:
  com.docker.desktop.address=unix:///Users/scott/Library/Containers/com.docker.docker/Data/docker-cli.sock
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: daemon is not using the default seccomp profile

Anything else?

No response

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

Successfully merging a pull request may close this issue.

1 participant