Skip to content

Use /etc/host_hostname #22

@james-emerton

Description

@james-emerton

The upstream logspout project supports reading /etc/host_hostname to determine the hostname. This allows one to expose the actual hosts name to the container rather than using the container id.

Currently, this does not work for logdna's logspout as the HOSTNAME environment variable appears to be the only way to set the hostname.

I am currently working around this as follows:

docker run -d \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /etc/hostname:/etc/host_hostname:ro \
  -e LOGDNA_KEY=<key> \
  --entrypoint /bin/sh \
  logdna/logspout:latest \
  -c "HOSTNAME=\`cat /etc/host_hostname\` /bin/logspout"

I'm starting this container as part of an image baking process, so I cannot set the hostname to the value at the time the container is created as it will change.

Metadata

Metadata

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions