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

hostnames are not propagated to other containers in the same network #19025

Closed
benoitf opened this issue Jun 28, 2023 · 5 comments
Closed

hostnames are not propagated to other containers in the same network #19025

benoitf opened this issue Jun 28, 2023 · 5 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. network Networking related issue or feature

Comments

@benoitf
Copy link
Contributor

benoitf commented Jun 28, 2023

Issue Description

Here is a difference with hosts handling between docker and podman

in docker if you start a container with a given hostname on a custom network, this hostname is reachable from other containers on the same network

in podman it's not the case

Steps to reproduce the issue

Steps to reproduce the issue

steps on docker:

  1. Create network
$ docker network create my-network
  1. Start the first container (here for example a database) using a host
$ docker run -d --name redis-container --hostname redis --network my-network redis
  1. start a fedora container for example
$ docker run -d --name fedora-container --hostname fedora --network my-network fedora tail -f /dev/null
  1. Now connect to the fedora container and try to ping 'redis' host
$ docker exec -ti fedora-container bash
[root@fedora /]# yum install -y iputils
[root@fedora /]# ping redis
PING redis (172.20.0.2) 56(84) bytes of data.
64 bytes from redis-container.my-network (172.20.0.2): icmp_seq=1 ttl=64 time=0.187 ms
64 bytes from redis-container.my-network (172.20.0.2): icmp_seq=2 ttl=64 time=0.096 ms

it works and it's replying from redis-container.my-network

Now, using podman:

steps on podman:

  1. Create network
$ podman network create my-network
  1. Start the first container (here for example a database) using a host
$ podman run -d --name redis-container --hostname redis --network my-network redis
  1. start a fedora container for example
$ podman run -d --name fedora-container --hostname fedora --network my-network fedora tail -f /dev/null
  1. Now connect to the fedora container and try to ping 'redis' host
$ podman exec -ti fedora-container bash
[root@fedora /]# yum install -y iputils
root@fedora /]# ping redis
ping: redis: Name or service not known

it doesn't work, name is not found

of course it works using the container name but it's not what was expected

[root@fedora /]# ping redis-container
PING redis-container.dns.podman (10.89.2.2) 56(84) bytes of data.
64 bytes from 10.89.2.2 (10.89.2.2): icmp_seq=1 ttl=64 time=0.074 ms
64 bytes from 10.89.2.2 (10.89.2.2): icmp_seq=2 ttl=64 time=0.084 ms
64 bytes from 10.89.2.2 (10.89.2.2): icmp_seq=3 ttl=64 time=0.082 ms
64 bytes from 10.89.2.2 (10.89.2.2): icmp_seq=4 ttl=64 time=0.112 ms

Describe the results you received

From the fedora container

[root@fedora /]# ping redis
ping: redis: Name or service not known

Describe the results you expected

expect to have the ping to the hostname of the other container working

podman info output

4.5.1

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

Additional environment details

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

@rhatdan
Copy link
Member

rhatdan commented Jun 28, 2023

@Luap99 PTAL

@Luap99 Luap99 added the network Networking related issue or feature label Jun 28, 2023
@Luap99
Copy link
Member

Luap99 commented Jun 28, 2023

Duplicate of #17370 I assume

@benoitf
Copy link
Contributor Author

benoitf commented Jun 28, 2023

looks like 👍

@benoitf
Copy link
Contributor Author

benoitf commented Jun 28, 2023

closing as dup of #17370

@Luap99
Copy link
Member

Luap99 commented Jun 28, 2023

I put it on my TODO list, the fix should be easy enough.

@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 26, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. network Networking related issue or feature
Projects
None yet
Development

No branches or pull requests

3 participants