docker / docker/cli

Extend `docker container update` to support updating ports

Open
#5,013 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description
Motivation

Usernetes Gen2 (Kubernetes in Rootless Docker) currently requires all the ports to be hard-coded in docker-compose.yaml, and the port list cannot be updated without restarting the entire Kubernetes node container:
https://github.com/rootless-containers/usernetes/blob/gen2-v20240410.0/docker-compose.yaml#L13-L21

Extending docker container update to support modifying ports will allow dynamically updating the port list without restarting the entire Kubernetes node container.

This should be useful for other Kubernetes-in-Docker, Docker-in-Docker, and similar stacks.

CLI syntax designs
Option A: docker container update CONTAINER --add-publish=NEWPORT

Example: remove 8080:81, keep 8081:81 untouched, add 8082:82

docker container run --name=foo -p 8080:80 -p 8081:81 foo
docker container update foo --remove-publish=8080 --add-publish=8082:82

Example: remove all the ports

docker container update foo --remove-publish=8081 --remove-publish=8082
Option B: docker container portx add CONTAINER NEWPORT

Example: remove 8080:81, keep 8081:81 untouched, add 8082:82

docker container run --name=foo -p 8080:80 -p 8081:81 foo
docker container portx remove foo 8080
docker container portx add foo 8082:82

Example: remove all the ports

docker container portx remove foo 8081 8082
Option C: docker container update CONTAINER --publish=PORT ...

Example: remove 8080:81, keep 8081:81 untouched, add 8082:82

docker container run --name=foo -p 8080:80 -p 8081:81 foo
docker container update foo -p 8081:81 -p 8082:82

Example: remove all the ports

docker container update foo -p none

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 by reviewing the linked docker-compose.yaml example and the three proposed docker container update or portx command designs. Before implementation, resolve which syntax and port-update behavior is intended; done means the selected design supports changing the port list without restarting the container.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.