Hostname not set in metadata service

Hello everyone,

I am trying the metadata service, but for some reason it seems the hostname is not set in the returned JSON (I am using JSON). I get something like this

  'health_state': None,
  'host_uuid': '89d17a73-fa31-4c53-80fe-fbdbea0161fd',
  'hostname': None,
  'ips': [''],
  'labels': {'io.rancher.container.hostname_override': 'container_name',
             '': 'elasticsearch',
             '': 'elasticsearch/elasticsearch-datanodes',
             'io.rancher.scheduler.affinity:container_label_ne': '${stack_name}/${service_name}',
             'io.rancher.scheduler.affinity:container_label_soft': 'io.rancher.service.deployment.unit=fc594957-cc1e-46d6-b860-15cec4956048',
             'io.rancher.service.deployment.unit': 'fc594957-cc1e-46d6-b860-15cec4956048',
             'io.rancher.service.hash': '3be4d2cccf8e55516b278adeeba638ffeb44059b',
             'io.rancher.service.launch.config': 'io.rancher.service.primary.launch.config',
             'io.rancher.sidekicks': 'elasticsearch-base-datanode,elasticsearch-datavolume-datanode',
             '': 'elasticsearch',
             '': 'elasticsearch/elasticsearch-datanodes'},
  'name': 'elasticsearch_elasticsearch-datanodes_1',
  'ports': [],
  'primary_ip': '',
  'service_index': '1',
  'service_name': 'elasticsearch-datanodes',
  'stack_name': 'elasticsearch',
  'start_count': 1,
  'uuid': '2c7e8b1d-1e7c-44a7-8422-0ac28d4eb5c6'},```

Also, I am assuming this *hostname* and *host_uui* would correspond the one of the hardware host running this container, is this assumption right? 

Is there something I need to do to get the hostname in the response?

I am using /latest as metadata endpoint.

Best regards,


It looks like there is a bug where the hostname in the metadata is not showing up if it is set in the container, but by default, the hostname in the container is not set unless you select an option in the UI.

Thanks for the reply Denise,

I was wondering is there a way to get the “hardware” hostname in the metadata.



Unfortunately, no, there is no way to get the hardware hostname.