'Dockerfile RUN command multiple inputs

I have a Dockerfile using which I am trying to build an image. I wish to have multiple inputs fetched from the user from STDIN, when the build runs. To get started, I used the line:

RUN read -p "a=" a && read -p "b=" b && echo $((a*b))

in the Dockerfile, but when I build image from that Dockerfile (which is just supposed to have base container & this RUN command), it only gets the value of a, and get stuck there in STDIN, exiting only when Ctrl+C is pressed, without proceeding any further.

Can you suggest a solution to get multiple inputs from STDIN in this case ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source