Skip to content

[BUG] docker compose a few env files and args section #11029

@pmiroslawski

Description

@pmiroslawski

Description

Here's the example of docker-compose.yml file which contains a service and has defined two files as the env_file

version: '3.9'
services:
  admin:
    ...
    build:
      context: .
      ...
      args:
        - SSH_USER=$SSH_USER
    env_file:
      - .env
      - .env.local
...

The content of .env file is:

SSH_USER="change-me"

The content of .env.local file is:

SSH_USER="change-me2"

Here's the result of docker compose config command:

services:
  admin:
    build:
      ...
      args:
        SSH_USER: change-me
    ...
    environment:
      SSH_USER: change-me2

Environment variables have been set correctly, but why hasn't the value in the args section been updated to reflect the environment variables?

Steps To Reproduce

No response

Compose Version

Docker Compose version v2.21.0

Docker Environment

Client: Docker Engine - Community
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.20.7
 Git commit:        ed223bc
 Built:             Mon Sep  4 12:31:44 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.6
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.7
  Git commit:       1a79695
  Built:            Mon Sep  4 12:31:44 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.24
  GitCommit:        61f9fd88f79f081d64d6fa3bb1a0dc71ec870523
 runc:
  Version:          1.1.9
  GitCommit:        v1.1.9-0-gccaecfc
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions