what environment does a build "RUN" run in?
In the Dockerfile, the RUN step is performed during the docker build process. The operating system is shared with the host (containers != VMs). The filesystem and rest of the configuration used to define the temporary container is based on the state of the image resulting from the previous step. Each step in the Dockerfile extends the image with additional metadata and filesystem layers.

The RUN step itself is performed inside a temporary container. The output of the RUN step is any filesystem changes that exist in the container at the time the command exits successfully. Changes to the shell (like a cd command or setting an environment variable inside the shell), spawned processes, and changes to files inside a Volume are all discarded. The changes to the container filesystem are captured as a filesystem layer that is included in the resulting image.