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

Environment variables from legacy containers links have disappeared with docker 29.0

未关闭
#6,666 3 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
docker, go
领域
cli, networking

调研方向

从文档中记录的 --link 行为开始,在 Ubuntu 上针对 Docker 28.5.1 和 29.0.2 运行双容器复现。追踪 legacy link 环境变量在哪里生成或被省略,然后验证 CONTAINER1_PORT 及相关变量是否在第二个容器中恢复,或者文档是否清楚地记录了这是一次有意的变更。

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

描述

kind/question status/0-triage version/29.0
Description

Environment variables created by docker when using legacy containers links disappeared with docker 29.0: https://docs.docker.com/engine/network/links/#environment-variables

Reproduce
  1. docker run --rm --name container1 -p 1234 -d ubuntu sleep infinity > /dev/null
  2. docker run --rm --name container2 --link container1 ubuntu env

cleanup:

  • docker stop container1 --timeout 0 > /dev/null
Expected behavior

CONTAINER1_PORT should exist in step 2, as well as other CONTAINER1_* environment variables:

docker 28.5.1: (5:28.5.2-1~ubuntu.22.04~jammy)

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=aa0dd55feb85
CONTAINER1_PORT=tcp://172.17.0.2:1234
CONTAINER1_PORT_1234_TCP=tcp://172.17.0.2:1234
CONTAINER1_PORT_1234_TCP_ADDR=172.17.0.2
CONTAINER1_PORT_1234_TCP_PORT=1234
CONTAINER1_PORT_1234_TCP_PROTO=tcp
CONTAINER1_NAME=/container2/container1
HOME=/root

docker 29.0.2: (5:29.0.2-1~ubuntu.22.04~jammy)

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=d2d80ab01a89
HOME=/root

tested on ubuntu 22.04 and 24.04 with the docker apt repository

docker version
Client: Docker Engine - Community
 Version:           29.0.2
 API version:       1.52
 Go version:        go1.25.4
 Git commit:        8108357
 Built:             Mon Nov 17 12:33:14 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          29.0.2
  API version:      1.52 (minimum version 1.44)
  Go version:       go1.25.4
  Git commit:       e9ff10b
  Built:            Mon Nov 17 12:33:14 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v2.1.5
  GitCommit:        fcd43222d6b07379a4be9786bda52438f0dd16a1
 runc:
  Version:          1.3.3
  GitCommit:        v1.3.3-0-gd842d771
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
docker info
Client: Docker Engine - Community
 Version:    29.0.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.30.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.40.3
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 18
  Running: 6
  Paused: 0
  Stopped: 12
 Images: 137
 Server Version: 29.0.2
 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: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Discovered Devices:
  cdi: nvidia.com/gpu=0
  cdi: nvidia.com/gpu=GPU-xxx
  cdi: nvidia.com/gpu=all
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2 nvidia
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: fcd43222d6b07379a4be9786bda52438f0dd16a1
 runc version: v1.3.3-0-gd842d771
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-87-generic
 Operating System: Ubuntu 22.04.5 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: xxxGiB
 Name: xxx
 ID: xxx
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: xxx
 Experimental: false
 Insecure Registries:
  nuc:5000
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Firewall Backend: iptables
Additional Info

I understand the --link flag is a legacy feature, but the documentation only says it "may eventually be removed", and I didn't find any mention of changes on this documentation or the docker engine v29 release blog.

主要语言
Go
星标
6.1k
派生
2.2k
平均合并
1 天 11 小时
30 天内合并 PR
30

环境准备

从这里开始

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

docker/cli 的其他 Issue

查看 docker/cli 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

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