docker / docker/cli

[proposal] Add stack name to environment / allow substitution in compose file

Open
#2,255 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area/stack area/swarm kind/enhancement
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

I expect most naming conventions do leverage the name of the stack. Unfortunately, this name is not available for substitution in compose file. Since the stack name is known to any stack command, i propose to add the name of the stack as environment variable which can be used for substitution.

Example / Use case:

version: "3.7"
networks:
  default:
    external: true
    name: ${STACK_NAME}_default

Side note: Rancher does provide a similar feature already (see https://github.com/rancher/rancher/issues/3393).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the stack command, where the stack name is known, and the compose-file substitution path. Confirm how an environment variable could expose that name for substitutions such as ${STACK_NAME}_default; done means the variable is available during stack deployment and the example resolves as expected. No source files or tests are named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker-compose, go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.