-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
host.containers.internal is inconsistent for rootful containers assigned to a pod and not #13277
Comments
I bet this is related to subsequent containers in the pod adding a |
@mheon We should discuss a complete /etc/hosts handling rewrite. IMO we should move it into c/common so that buildah can use it to. Also it has to support adding/removing entries from an already existing file. The first step would be to come up with a proper description on what entries should be in there with a given network mode and pod. Right now we always change a tiny thing and it keeps breaking something else. |
SGTM - this sounds like a good way to clean things up |
OK I will create a proposal this week. |
While we're on the subject of Brainstorming here...
Options like |
Why not just volume mount in the hosts file that you want. Otherwise I see the options getting out of hand. |
I had the same thought and agree with the sentiment. It is very helpful to give podman some freedom to manipulate the hosts file to add entries such as |
How about --no-hosts --add-hosts .... Which would eliminate the hosts /etc/hosts and would force the user to add his own. |
To me This seems fairly versatile:
Auto entries include manipulations such as adding the container’s own IP address and any hosts from In addition, changing Lastly- All my containers are in various pods assigned to a custom network. What I see now is |
Containers on the same network share the same /etc/hosts and /etc/resolv.conf file. |
I modified your table, to match what I would expect. |
@vrothberg @mheon @Luap99 WDYT? |
I know that's the case today, but is this a nonnegotiable tenet of container networking? 😁 The scenario I'm working with is my app connects to services by hostname. I want to run two "identical" containers, each connecting to a different pod running the service endpoint. To achieve this, I need each container to have it's own service name --> pod ip host entry. |
You want them in the same pod? |
I lean towards putting all containers into pods so in this case I'd have four pods, each with one container, all on the same custom network. Two "front end" pods and two "service" pods. In essence, what would be ideal is if |
I am against adding new cli options. |
Are those meetings at 11 am ET as mentioned on podman.io or 10 am as mentioned in issue #10670? |
@lovette The meeting is this thursday at 11 am ET. https://podman.io/community/meeting/#next-meeting-thursday-march-17-2022-1100-am-edt-utc-4 |
Since the Community Cabal meeting yesterday I've been trying to reconcile the operational differences between using the default network and custom networks. On the face of it, one would think that moving from one to the other would simply give you more control over network properties. But in fact fundamental changes occur. Initially I was disappointed to learn .NetworkSettings fields are only populated for the default network (#10232). Through the discussion of this issue, I realize that Given this, the table above (proposing new options, but also documenting how
I contend there shouldn't be so much variance between default and custom networks and as such the effect of As things stand now, the off-the-cuff solution for the scenario I describe above is to put containers that need specific hosts into their own network. But managing N containers on N+1 networks and bridging traffic between them is, if possible at all, a non-trivial amount of work. As for my proposed options, if adding one like |
There is no difference between containers on default or custom network! There should also be no difference for rootless/rootful. Please provide reproducers if you see actual differences. You will see differences for |
Well, I swear I experienced a container
In light of this... in addition to ironing out the kinks in /etc/hosts management, I'd still like to lobby for the need for a When mounting a hosts file using
This means there is no runtime mechanism to both ignore the host's |
I stumbled across another reason to make hosts management more flexible... the Visual Studio Code Remote-Containers extension fails its container setup if container hosts does not define |
base_hosts_file can be used to overwrite the default base host file /etc/hosts which is used to copy hosts entries from this file into the containers /etc/hosts file. As special value "image" can be used to copy the entires from the image hosts file or an empty string "" to not use a base file at all. Ref containers/podman#13277 Ref containers/podman#13748 Signed-off-by: Paul Holzinger <[email protected]>
base_hosts_file can be used to overwrite the default base host file /etc/hosts which is used to copy hosts entries from this file into the containers /etc/hosts file. As special value "image" can be used to copy the entries from the image hosts file or an empty string "" to not use a base file at all. Ref containers/podman#13277 Ref containers/podman#13748 Signed-off-by: Paul Holzinger <[email protected]>
base_hosts_file can be used to overwrite the default base host file /etc/hosts which is used to copy hosts entries from this file into the containers /etc/hosts file. As special value "image" can be used to copy the entries from the image hosts file or an empty string "" to not use a base file at all. Ref containers/podman#13277 Ref containers/podman#13748 Signed-off-by: Paul Holzinger <[email protected]>
base_hosts_file can be used to overwrite the default base host file /etc/hosts which is used to copy hosts entries from this file into the containers /etc/hosts file. As special value "image" can be used to copy the entries from the image hosts file or an empty string "" to not use a base file at all. Ref containers/podman#13277 Ref containers/podman#13748 Signed-off-by: Paul Holzinger <[email protected]>
base_hosts_file can be used to overwrite the default base host file /etc/hosts which is used to copy hosts entries from this file into the containers /etc/hosts file. As special value "image" can be used to copy the entries from the image hosts file or "none" to not use a base file at all. IF the value is empty we should use /etc/hosts as default. Ref containers/podman#13277 Ref containers/podman#13748 Signed-off-by: Paul Holzinger <[email protected]>
base_hosts_file can be used to overwrite the default base host file /etc/hosts which is used to copy hosts entries from this file into the containers /etc/hosts file. As special value "image" can be used to copy the entries from the image hosts file or "none" to not use a base file at all. IF the value is empty we should use /etc/hosts as default. Ref containers/podman#13277 Ref containers/podman#13748 Signed-off-by: Paul Holzinger <[email protected]>
base_hosts_file can be used to overwrite the default base host file /etc/hosts which is used to copy hosts entries from this file into the containers /etc/hosts file. As special value "image" can be used to copy the entries from the image hosts file or "none" to not use a base file at all. IF the value is empty we should use /etc/hosts as default. Ref containers/podman#13277 Ref containers/podman#13748 Signed-off-by: Paul Holzinger <[email protected]>
base_hosts_file can be used to overwrite the default base host file /etc/hosts which is used to copy hosts entries from this file into the containers /etc/hosts file. As special value "image" can be used to copy the entries from the image hosts file or "none" to not use a base file at all. IF the value is empty we should use /etc/hosts as default. Ref containers/podman#13277 Ref containers/podman#13748 Signed-off-by: Paul Holzinger <[email protected]>
base_hosts_file can be used to overwrite the default base host file /etc/hosts which is used to copy hosts entries from this file into the containers /etc/hosts file. As special value "image" can be used to copy the entries from the image hosts file or "none" to not use a base file at all. IF the value is empty we should use /etc/hosts as default. Ref containers/podman#13277 Ref containers/podman#13748 Signed-off-by: Paul Holzinger <[email protected]>
I just noticed the activity related to this issue. (GH doesn't send notifications for "commit references".) Will the addition of a system wide |
Not yet implemented but I see the value, it should be simple to add once my first changes are merged. |
A friendly reminder that this issue had no activity for 30 days. |
@Luap99 any progress? |
Not yet |
What is the current thinking as far as cli arguments go? Is it feasible to enhance |
A friendly reminder that this issue had no activity for 30 days. |
A friendly reminder that this issue had no activity for 30 days. |
A friendly reminder that this issue had no activity for 30 days. |
@Luap99 any chance you can work on this? |
I've finally had a chance to upgrade podman so my project can take advantage of the new I could achieve nearly all the flexibility I need with the addition of a
With that in place, the only scenario then missing is the ability to also prevent the "auto" entries from being added to the container
|
I'm adding the CLI flags since I've added a container level |
Thanks @gavinkflam, I'm excited to try this out! Maybe I can use this to work around the fact that |
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
When rootless, the IP assigned to
host.containers.internal
is consistent between pod and non-pod containers and refers to the host "public IP".When rootful,
host.containers.internal
entries are not consistent.This leads me to wonder- Is it a bug that rootful containers have such wildly different host entries? If not, why have the same name assigned to two IPs? And why do non-pod containers not get an entry for the host "public IP"?
Steps to reproduce the issue:
*** Rootless ***
*** Rootful ***
Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):
Running on CentOS 9 Stream in a VMware Fusion VM.
The text was updated successfully, but these errors were encountered: