How do I make Timecout command from entry point in Dockerfile

  docker, dockerfile, shell, timeout

I have been trying to run timeout command on my shellscript with time being passed as variabe through Dockerfile

This is my DokcerFile(sample)

FROM locustio/locust:1.2.3


COPY --chown=locust:locust .

RUN echo  "Hello $TIME_CHECK"

RUN chown locust:locust /home/locust && chmod +x ./

ENTRYPOINT ["/bin/bash","-c", "timeout $TIME_CHECK ./"]

Docker build happens successfully with below command and I can the value being passed correctly

docker build -t pingit --build-arg TIME_CHECK=10

When I do docker run it fails with following error

Try ‘timeout –help’ for more information.

I do understand this is because ENTRYPOINT is not recogninsing variable as such.

What am I doing wrong can you anyone help me here.

Source: Docker Questions