# Understanding Fallback files

**URL:** <https://community.doppler.com/t/understanding-fallback-files/238>\
**Category:** Need Help\
**Created:** [June 11, 2021, 6:18am UTC](https://community.doppler.com/t/understanding-fallback-files/238 "2021-06-11T06:18:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanmay](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/tanmay/32/163_2.png) [@tanmay](https://community.doppler.com/u/tanmay)\
**Post date:** [June 11, 2021, 6:18am UTC](https://community.doppler.com/t/understanding-fallback-files/238/1 "2021-06-11T06:18:04Z")

</div>

Hi everyone,

Really enjoying using doppler. It would be great if you could clear a small doubt of mine.

As stated in this link,

> **[Secret Fallback Files](https://docs.doppler.com/docs/automatic-fallbacks)**
>
> When using the doppler run command, the CLI automatically creates a fallback file containing an encrypted snapshot of the current secrets in JSON format to Doppler's system configuration directory.This guide documents how the fallback file works and...

> Every time you run doppler run – ./your-command-here the command-line tool will automatically create a snapshot of your latest secrets and store it in an encrypted file. Then when we are unable to connect to the API, like if you are doing local development on a plane, the Doppler CLI will smartly fallback to this snapshot. The snapshot lives outside of your working directory in a dedicated folder managed by Doppler to ensure it is never committed to your git history.

So basically any service running on Doppler would download the fallback file as a backup, right?  
But the below screenshot is confusing me a little bit-

 ![Screenshot from 2021-06-11 10-12-08](https://us1.discourse-cdn.com/flex016/uploads/doppler/original/1X/665a196d3c4ebf930767ef6bc74935601afa2846.png)

Why we need to download a fallback file specifically for Dockerfiles, shouldn’t doppler automatically download the fallback file in case of docker as well, as stated in the first link? Why do i need to write -

```auto
RUN doppler secrets download doppler.encrypted.json
ENTRYPOINT ["doppler", "run", "--fallback=doppler.encrypted.json", "--"]

```

and not just

```auto
ENTRYPOINT ["doppler", "run", "--"]

```

Shouldn’t the second command work as well if the doppler API is down; since it downloads the fallback file once `doppler run ` is passed?

---

<div class="post-metadata">

**Author:** ![ryan-blunden](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/ryan-blunden/32/9_2.png) [@ryan-blunden](https://community.doppler.com/u/ryan-blunden)\
**Post date:** [June 11, 2021, 6:57am UTC](https://community.doppler.com/t/understanding-fallback-files/238/2 "2021-06-11T06:57:15Z")

</div>

Hi @ [anmay](https://community.doppler.com/u/tanmay) and welcome to the Doppler community!

Sorry for the confusion here and I’ll definitely revise our docs to make this easier to understand in the future.

In reference to this code:

```auto
RUN doppler secrets download doppler.encrypted.json
ENTRYPOINT ["doppler", "run", "--fallback=doppler.encrypted.json", "--"]

```

It’s done in this way to make it clear in the Dockerfile that we’re intentionally creating a secrets fallback file but really, any command that causes secrets to be fetched from Doppler will also create the fallback file.

To illustrate, you could replace the above two lines with the following:

```auto
RUN doppler run -- echo "creating fallback file"
ENTRYPOINT ["doppler", "run", "--"]

```

The end result is exactly the same, but in this case, we’re letting the CLI save the fallback file to its default location.

Does that clear things up?

---

<div class="post-metadata">

**Author:** ![tanmay](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/tanmay/32/163_2.png) [@tanmay](https://community.doppler.com/u/tanmay)\
**Post date:** [June 11, 2021, 7:15am UTC](https://community.doppler.com/t/understanding-fallback-files/238/3 "2021-06-11T07:15:10Z")

</div>

Ah alright, so with the first command

```auto
RUN doppler secrets download doppler.encrypted.json
ENTRYPOINT ["doppler", "run", "--fallback=doppler.encrypted.json", "--"]

```

I can basically customize the location where I need to store the fallback file, right?

---

<div class="post-metadata">

**Author:** ![ryan-blunden](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/ryan-blunden/32/9_2.png) [@ryan-blunden](https://community.doppler.com/u/ryan-blunden)\
**Post date:** [June 11, 2021, 7:49am UTC](https://community.doppler.com/t/understanding-fallback-files/238/4 "2021-06-11T07:49:23Z")

</div>

> I can basically customize the location where I need to store the fallback file, right?

Yes, exactly. That’s the primary benefit of that approach.

---

<div class="post-metadata">

**Author:** ![thomasp](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/thomasp/32/785_2.png) [@thomasp](https://community.doppler.com/u/thomasp)\
**Post date:** [June 11, 2021, 5:28pm UTC](https://community.doppler.com/t/understanding-fallback-files/238/5 "2021-06-11T17:28:41Z")

</div>

There’s one other benefit, which is that Docker containers are generally ephemeral. This means that any changes made to the image won’t persist for the next run. So a fallback file will be generated when calling `doppler run`, but it’ll be erased before your next container invocation (i.e. the next `doppler run`). By saving the fallback file during the build phase, you’re ensuring that it’ll be persisted in the image.
