How does one copy environment variables from one Docker image to another?

FROM ubuntu:latest as app

touch qwe.txt

ENV ASD=1

How can I copy the environment variable to another image? I know how to do it with files but not with environment variables. Is this even possible?

FROM ubuntu:latest

COPY --from=app / /

# qwe.txt is now here but $ASD is not.

Same question as this one.

Build Stage 1

FROM ubuntu:latest as app
ENV ASD=1

Build Stage 2

FROM app
Run echo $ASD > env_variable