You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.
The entrypoint script for this container uses parameter substitutions like this:
if [ -n "${SERVICE_HOST_ENV_NAME+1}" ]; then
# get value of the env variable in SERVICE_HOST_ENV_NAME as host, if that's not set,
# SERVICE_HOST_ENV_NAME has the host value
TARGET_SERVICE=${!SERVICE_HOST_ENV_NAME:=$SERVICE_HOST_ENV_NAME}
fi
if [ -n "${SERVICE_PORT_ENV_NAME+1}" ]; then
# get value of the env variable in SERVICE_PORT_ENV_NAME as port, if that's not set,
# SERVICE_PORT_ENV_NAME has the port value
TARGET_SERVICE="$TARGET_SERVICE:${!SERVICE_PORT_ENV_NAME:=$SERVICE_PORT_ENV_NAME}"
fi
If you build a container from this today, it will no longer start correctly. The upstream container (FROM nginx) has been updated to a newer OS version (debian stretch) which comes with a newer version of bash (4.4.11(1)-release) which no longer permits this type of substitution.
The errors look like the following when start.sh is run, which then causes errors for nginx startup because the parameters weren't substituted in correctly:
Enabling SSL...
./start.sh: line 48: servicename.default.svc.cluster.local: bad substitution
Starting nginx...
./start.sh: line 52: 8443: invalid variable name
2017/05/26 02:12:07 [emerg] 8#8: invalid number of arguments in "server" directive in /etc/nginx/conf.d/proxy.conf:2
nginx: [emerg] invalid number of arguments in "server" directive in /etc/nginx/conf.d/proxy.conf:2
The text was updated successfully, but these errors were encountered:
I tried making a more verbose conditional to achieve the same result, but this errors too:
if [ -n "${SERVICE_HOST_ENV_NAME+1}" ]; then
# get value of the env variable in SERVICE_HOST_ENV_NAME as host, if that's not set,
# SERVICE_HOST_ENV_NAME has the host value
if [ -n "${!SERVICE_HOST_ENV_NAME+1}" ]; then
TARGET_SERVICE=${!SERVICE_HOST_ENV_NAME}
else
TARGET_SERVICE=${SERVICE_HOST_ENV_NAME}
fi
fi
With bash 4.4, I can't seem to find a way to 'test' if a variable's value is actually a VAR name I can use an indirect reference with. If I try to "test" it with an if statement, it just tells me bad substitution if the indirect reference attempt references an unset variable.
As of at least today, I'm getting bash 4.4.12 when building the Dockerfile:
root@c12e3bcbc7da:/usr/src# bash --version
GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
root@c12e3bcbc7da:/usr/src# FOO=BAR
root@c12e3bcbc7da:/usr/src# BAR="asdasdf"
root@c12e3bcbc7da:/usr/src# echo ${!FOO}
asdasdf
λ docker run -it \
> -p 8088:80 \
> -e ENABLE_SSL=false \
> -e SERVICE_HOST_ENV_NAME=docker.for.mac.localhost \
> -e SERVICE_PORT_ENV_NAME=8888 \
> nginx-ssl-proxy
./start.sh: line 44: docker.for.mac.localhost: bad substitution
./start.sh: line 48: 8888: invalid variable name
Starting nginx...
2018/07/19 00:08:11 [emerg] 10#10: invalid number of arguments in "server" directive in /etc/nginx/conf.d/proxy.conf:2
nginx: [emerg] invalid number of arguments in "server" directive in /etc/nginx/conf.d/proxy.conf:2
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The entrypoint script for this container uses parameter substitutions like this:
If you build a container from this today, it will no longer start correctly. The upstream container (FROM nginx) has been updated to a newer OS version (debian stretch) which comes with a newer version of bash (4.4.11(1)-release) which no longer permits this type of substitution.
The errors look like the following when start.sh is run, which then causes errors for nginx startup because the parameters weren't substituted in correctly:
The text was updated successfully, but these errors were encountered: