socket.getfqdn() will return the reverse lookup for 127.0.1.1, which is
the last item listed for that IP in /etc/hosts. Podman, by default, will
append the container name (ceph-$fsid-$name) to that line, which is not
a valid hostname, and not what we want the dashbaord to use for the URI
it advertises in the service map.
Pass --no-hosts to podman to disable this.
Docker does not appear to modify /etc/hosts by default--or, more
importantly, does not add the container name there.
Explicitly instruct podman (and docker) to add a
Fixes: https://tracker.ceph.com/issues/49890
Signed-off-by: Sage Weil <sage@newdream.net>
(cherry picked from commit
cfc1f914ce74f1fd1f45e2efd3ba2ddcb2da129a)
'--ipc=host',
]
- if 'podman' in self.ctx.container_path and \
- os.path.exists('/etc/ceph/podman-auth.json'):
- cmd_args.append('--authfile=/etc/ceph/podman-auth.json')
+ if 'podman' in self.ctx.container_path:
+ # podman adds the container *name* to /etc/hosts (for 127.0.1.1)
+ # by default, which makes python's socket.getfqdn() return that
+ # instead of a valid hostname.
+ cmd_args.append('--no-hosts')
+ if os.path.exists('/etc/ceph/podman-auth.json'):
+ cmd_args.append('--authfile=/etc/ceph/podman-auth.json')
envs: List[str] = [
'-e', 'CONTAINER_IMAGE=%s' % self.image,