Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not add an entry to /etc/hosts with --net=host #11118

Merged
merged 1 commit into from
Aug 4, 2021

Conversation

mheon
Copy link
Member

@mheon mheon commented Aug 3, 2021

To match Docker's behavior, in the --net=host case, we need to use the host's /etc/hosts file, unmodified (without adding an entry for the container). We will still respect hosts from --add-host but will not make any automatic changes.

Fortuntely, this is strictly a matter of removal and refactoring as we already base our /etc/hosts on the host's version - just need to remove the code that added entries when net=host was set.

Fixes #10319

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 3, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mheon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 3, 2021
@mheon mheon force-pushed the use_host_resolveconf branch from 1676a45 to 952c857 Compare August 3, 2021 20:00
@cdoern
Copy link
Contributor

cdoern commented Aug 4, 2021

code LGTM but tests failing

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

LGTM but there is a failing test

To match Docker's behavior, in the `--net=host` case, we need to
use the host's `/etc/hosts` file, unmodified (without adding an
entry for the container). We will still respect hosts from
`--add-host` but will not make any automatic changes.

Fortuntely, this is strictly a matter of removal and refactoring
as we already base our `/etc/hosts` on the host's version - just
need to remove the code that added entries when net=host was set.

Fixes containers#10319

Signed-off-by: Matthew Heon <[email protected]>
@mheon mheon force-pushed the use_host_resolveconf branch from 952c857 to cfcd1e1 Compare August 4, 2021 13:54
@mheon
Copy link
Member Author

mheon commented Aug 4, 2021

Well, that test will never work now. Removing it.

@Luap99
Copy link
Member

Luap99 commented Aug 4, 2021

/lgtm
/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 4, 2021
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 4, 2021
@mheon
Copy link
Member Author

mheon commented Aug 4, 2021

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 4, 2021
@openshift-ci openshift-ci bot merged commit 6ff1964 into containers:main Aug 4, 2021
@anilwavde
Copy link

Can someone please confirm, if this fix available in 2.2.1 release as well or merged into latest only?

@mheon
Copy link
Member Author

mheon commented Aug 4, 2021

No, it is not available in v2.2.1. That release is long since out of support, and is no longer receiving backports.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
4 participants