I see. So the issue is that even though the variable is set in my shell, I have to export it? This is confusing, I haven’t seen that kind of behavior before. Eg:
> set | grep HOSTNAME
HOSTNAME=foo
> docker-compose up
WARNING: The HOSTNAME variable is not set. Defaulting to a blank string.
Starting dockercomposeenvvariables_test_1
Attaching to dockercomposeenvvariables_test_1
test_1 | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
test_1 | HOSTNAME=2d4d5e216cb6
test_1 | HOST_HOSTNAME=
test_1 | HOME=/root
dockercomposeenvvariables_test_1 exited with code 0
> export HOSTNAME=${HOSTNAME}
> docker-compose up
Recreating dockercomposeenvvariables_test_1
Attaching to dockercomposeenvvariables_test_1
test_1 | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
test_1 | HOSTNAME=9cb89136063e
test_1 | HOST_HOSTNAME=foo
test_1 | HOME=/root
dockercomposeenvvariables_test_1 exited with code 0
Is this intended behavior? I’ve never had to export variables that were already set in my shell before.