Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Proposal] Expose the container name in remoteEnv

未关闭
#778 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
15/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
docker, docker-compose

调研方向

This is a specification proposal, so there are no code files yet; the relevant text is the remoteEnv and variable-substitution sections of the devcontainer.json spec. Read the related issues linked in the body (spec #184 and #692) to see what has already been decided about container naming. Done means a written proposal that defines when ${containerName} is resolved, covers Docker Compose primary services, and is discussed by maintainers.

由索引模型根据 Issue 内容生成。

描述

A process running in a devcontainer may need its container’s runtime name for logging or tracking purposes. Today, there is no way to reference that name in remoteEnv. The name field in devcontainer.json is a display name and may differ from the name shown by Docker or Podman.

Add a ${containerName} variable that can be used in remoteEnv:

{
  "remoteEnv": {
    "DEVCONTAINER_CONTAINER_NAME": "${containerName}"
  }
}

${containerName} should resolve to the actual runtime name of the primary development container. It should work for both newly created and reused containers, including the primary service in a Docker Compose setup. The tool should resolve it before running lifecycle commands or starting other processes to which remoteEnv applies.

This does not change how containers are named. Because the value is only known after container creation, ${containerName} would not be available in creation-time settings such as containerEnv or runArgs.

Related requests: container name in devcontainer.json (https://github.com/devcontainers/spec/issues/184) and a CLI option to choose the name (https://github.com/devcontainers/spec/issues/692).

主要语言
没有语言数据
星标
5.8k
派生
503
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

devcontainers/spec 的其他 Issue

查看 devcontainers/spec 的全部 Issue

相似的 Issue

更多 DevTools Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。