No. Each RUN command spawns its own shell, and that shell’s environment disappears when the shell exits.
If you need to have this information available at runtime, you could cat it to a file and then use an entrypoint script to set it again when the container starts up.
If you need to have this information available externally, the two approaches I’ve used are (a) create a file with a well-known name like /etc/container-version and put this data there (and depend on docker run to get it out again), or (b) use a shell script to find this data before you run docker build, and either generate the Dockerfile or (in more recent Dockers) pass it as an ARG.
To others out there, there is currently (2018-06) no way to get a value created during a RUN command into an ENV command. Nor can you run backtick commands as a value on an ENV command.
If its a value you want at runtime, just make it an environment variable in your entrypoint (aka runtime).