docker / docker/cli

Environment variables from legacy containers links have disappeared with docker 29.0

Open
#6,666 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/question status/0-triage version/29.0
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

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.

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

Start with the documented --link behavior and run the two-container reproduction against Docker 28.5.1 and 29.0.2 on Ubuntu. Trace where legacy link environment variables are generated or omitted, then verify that CONTAINER1_PORT and the related variables are restored in the second container, or that the documentation clearly records an intentional change.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli, networking
Issue type
Bug
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.