-
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
[Bug]: host's /etc/hosts file overrides private network dns settings in podman #17167
Comments
Can you provide By default podman will copy all host entries from the host into the container. so this is expected. If you want to change that behaviour you can use the |
@Luap99 Added I was reading a bunch of articles on how podman tries to support docker and docker-compose apis as best it can... So I figured I would file this as the behavior you describe doesn't happen in docker for me... So maybe there should be a different default when run from docker-compose? Not sure, but thank you for the info on the containers.conf! |
Sure, matching Docker seems easy enough here given we already added support for various ways to use /etc/hosts |
A friendly reminder that this issue had no activity for 30 days. |
A friendly reminder that this issue had no activity for 30 days. |
@rhatdan This is a nice to have, I have much more higher priority stuff to do. It would be great if someone from the community could work on it.
|
Hi @Luap99 and @hcldan , I found this is fixed in main branch now by adding CONTAINERS_CONF environment variable in systemd unit file /usr/local/lib/systemd/system/podman.service:
/home/ywdeng/.config/containers/containers.conf:
home/ywdeng/Desktop/hosts:
Test:
So maybe simply adding a document about how to setting it? |
I worked on a fix by applying @Luap99's suggestions. Please help reviewing the PR #21013. @vincentywdeng CONTAINERS_CONF, containers.conf, and base_hosts_file are already documented here. |
* Add BaseHostsFile to container configuration * Do not copy /etc/hosts file from host when creating a container using Docker API Signed-off-by: Gavin Lam <[email protected]>
Issue Description
Moving over to a new machine with podman instead of docker, still ironing out the issues using docker-compose with podman.
I used to have a custom domain let's call it foo.bar.com, car.bar.com, etc mapped to 127.0.0.1 in my host's /etc/hosts file.
In the docker-compose.yml I had a private network with those same hosts set.
Inside the containers attached to the network, they would get the private network address, using podman they get 127.0.0.1
Steps to reproduce the issue
on host machine:
docker-compose.yml:
Describe the results you received
exec into proxy.bar.com
ping foo.bar.com
get 127.0.0.1
Describe the results you expected
I expected an ip inside the mynet address space
podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
RHEL 9.1
Additional information
No response
The text was updated successfully, but these errors were encountered: