I'm currently trying to add a HEALTHCHECK to my Dockerfile and so far it works great with this:
HEALTHCHECK --interval=15s --timeout=30s --start-period=60s \
CMD <healtcheck cmd (left out for brevity's sake)>
Now I would like to make the interval, timeout and start-period configurable via environment variables so I tried to change the code to:
ENV Docker_HealthCheck_Interval="15s"
ENV Docker_HealthCheck_Timeout="3s"
ENV Docker_HealthCheck_StartPeriod="60s"
HEALTHCHECK --interval=${Docker_HealthCheck_Interval} --timeout=${Docker_HealthCheck_Timeout} --start-period=${Docker_HealthCheck_StartPeriod} \
CMD <healtcheck cmd (left out for brevity's sake)>
Unfortunately that does not seem to work (I get Error response from daemon: Dockerfile parse error line 14: time: invalid duration ${Docker_HealthCheck_Interval} when building the Docker image).
Am I doing something wrong? Are variables not supported in the HEALTHCHECK directive? Is there any alternative way to achieve what I want?