compose icon indicating copy to clipboard operation
compose copied to clipboard

Warnings about unset environment variables even when not used in running containers

Open felipelima-circle opened this issue 7 months ago • 4 comments

Description

Description

The docker compose command outputs warnings about environment variables not being set, even when those variables are only used in services that are not currently being started.

For example, when running docker compose --profile profile1 up or docker compose up service_1, I get the following warning:

WARN[0000] The "BAR" variable is not set. Defaulting to a blank string.

You can use this docker-compose.yml file to reproduce the problem:

services:
  service_1:
    image: service_1
    profiles: [profile1]

  service_2:
    image: service_2
    profiles: [profile2]
    environment:
      ENV_VAR: ${BAR}

Environment

  • Docker Compose version: v2.28.1-desktop.1
  • Operating system: macOS 14.4.1 (Darwin 23.4.0 arm64)

felipelima-circle avatar Jul 09 '24 00:07 felipelima-circle