# Passing environment variable from workflow to job

**URL:** <https://discuss.circleci.com/t/passing-environment-variable-from-workflow-to-job/39417>\
**Category:** Build Environment\
**Created:** [March 15, 2021, 6:07pm UTC](https://discuss.circleci.com/t/passing-environment-variable-from-workflow-to-job/39417 "2021-03-15T18:07:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryeparrotsavannahrye](https://avatars.discourse-cdn.com/v4/letter/r/eada6e/32.png) [@ryeparrotsavannahrye](https://discuss.circleci.com/u/ryeparrotsavannahrye)\
**Post date:** [March 15, 2021, 6:07pm UTC](https://discuss.circleci.com/t/passing-environment-variable-from-workflow-to-job/39417/1 "2021-03-15T18:07:46Z")

</div>

I am using circle ci to build couple of docker images. The docker image rely on `-build-arg my_var=val`. I have modified my circleci job to handle this arg i.e.,

```
  build_image:
    docker: 
      - image: google/cloud-sdk:latestare run
    steps:
      - run: docker build --build-arg my_var=${my_var} -t .

```

Now the problem is that how would i pass `my_var` from `workflow` to the job. I used `command` but i think its illegal there.

```auto
workflows:
  version: 2

  build-image-and-deploy:
    jobs:
      - build_image:
         command: |
            echo "export my_var=val" >> $BASH_ENV

```
