Add container run hostname flag#1811
Conversation
|
@thromel The container |
|
Thanks, that makes sense. I verified locally that The gap I was trying to cover is Compose |
f9f25e2 to
db479c9
Compare
|
Let me think about this one. I'm not in love (right at this moment) with the idea of a hostname flag. We could use the alias feature you propose to get Compose hostname working for all but seemingly perverse cases where someone puts |
db479c9 to
b4d2be1
Compare
|
That matches the current split. I updated this PR to make the hostname flag an optional/separate path rather than a prerequisite for Compose support. #1815 carries aliases as the primary path; aliases can represent most Compose If keeping name and guest hostname coupled is the preferred API, this PR can be closed without blocking #1815/#1839. |
Type of Change
Motivation and Context
Apple
container runandcontainer createcurrently use the container name as the guest hostname through the first network attachment. Docker Compose also has a separatehostname:field, where the requested guest hostname can differ from the container management name.This PR adds
--hostname <hostname>to the shared management flags and uses it as the hostname for the first network attachment. The Linux runtime already derives the guest hostname from the first attachment hostname, so the change uses the existing persisted network attachment model rather than introducing a separate container configuration field.Design status
This is separate from the alias work in #1815/#1839. Aliases may cover most Compose
hostname:translation cases while keeping the container name and guest hostname coupled. This PR keeps the explicit hostname-override path available for review, but it is not required for the alias PR.Related to Compose compatibility work in Mcrich23/Container-Compose#119 and service/alias work in #1815/#1839.
Testing
Checks run:
The focused test run passed 122 tests after rebasing onto current
origin/mainand linked the CLI stack as part of the package test build.Earlier manual smoke test against the normal running service:
The command printed: