Dockerfile – set ENV to result of command
As an addition to DarkSideF answer. You should be aware that each line/command in Dockerfile is ran in another container. You can do something like this: RUN export bleah=$(hostname -f);echo $bleah; This is run in a single container.