RUN echo $MY_VARIABLE
ENV MY_VARIABLE="some value"
instead should i write like
ENV MY_VARIABLE="some value"
RUN echo $MY_VARIABLE
i want to know does order matter in dockerfile if i write run command first then put the ENV will it throw an error
Yes , I believe the order does matter. You should first declare the variable and set it.