Skip to content

Conversation

@MadLittleMods
Copy link
Collaborator

@MadLittleMods MadLittleMods commented Dec 8, 2025

Use COMPLEMENT_HOSTNAME_RUNNING_COMPLEMENT config for ExtraHosts in Docker

This isn't spawning from any problem (and I'm not making this change to fix anything specifically although probably fixes podman support). Internally, at Element, we're playing around with adding our own self-hosted GitHub runners and this piece of code was pointed out. I noticed it hard-coded host.docker.internal instead of using the config (from COMPLEMENT_HOSTNAME_RUNNING_COMPLEMENT) which seemed a bit suspect.

It looks like this regressed in #389 (previously, we we're using HostnameRunningComplement here)

Pull Request Checklist

// Note: this feature of docker landed in Docker 20.10,
// see https://github.com/moby/moby/pull/40007
extraHosts = []string{"host.docker.internal:host-gateway"}
extraHosts = []string{fmt.Sprintf("%s:host-gateway", cfg.HostnameRunningComplement)}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main change.

Using the value from our config instead of hard-coded.

Reference: COMPLEMENT_HOSTNAME_RUNNING_COMPLEMENT -> HostnameRunningComplement

HostnameRunningDocker = "localhost"
// HostnameRunningComplement is the hostname of Complement from the perspective of a Homeserver.
HostnameRunningComplement = "host.docker.internal"
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing as these seem unused

// Note: this feature of docker landed in Docker 20.10,
// see https://github.com/moby/moby/pull/40007
extraHosts = []string{"host.docker.internal:host-gateway"}
extraHosts = []string{fmt.Sprintf("%s:host-gateway", cfg.HostnameRunningComplement)}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this regressed in #389

(previously, we we're using HostnameRunningComplement here)

@MadLittleMods MadLittleMods marked this pull request as ready for review December 8, 2025 21:15
@MadLittleMods MadLittleMods requested review from a team and kegsay as code owners December 8, 2025 21:15
Copy link
Contributor

@devonh devonh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me. Hopefully this is transparent to people and nobody sees any breakages in their own setups.

@MadLittleMods MadLittleMods merged commit f86dadb into main Dec 19, 2025
4 checks passed
@MadLittleMods MadLittleMods deleted the madlittlemods/docker-hosts branch December 19, 2025 20:31
@MadLittleMods
Copy link
Collaborator Author

Thanks for the review @devonh 🐊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants