Reputation: 18114
I'm trying to do the following in my docker-compose.yml
But I hit this warning?
WARNING: The HOSTNAME variable is not set. Defaulting to a blank string
environment:
KAFKA_ADVERTISED_HOST_NAME: ${HOSTNAME}
The HOSTNAME environment variable is obviously set on the host.
Upvotes: 13
Views: 7807
Reputation: 792
You just need to export your environment variable to the docker-compose
process. Try this instead:
$ export HOSTNAME
$ docker-compose up
Source: https://forums.docker.com/t/docker-compose-not-seeing-environment-variables-on-the-host/11837/2
Upvotes: 11
Reputation: 4953
An error saying the variable is not set looks strange indeed.
I use host variables like this:
mycontainer:
image: <repo>/<image>:${SERVICE_VERSION}
environment:
- DB_USER=${DB_USER}
- DB_PASS=${DB_PASS}
Upvotes: 4