# Authenticating to github using docker login

**URL:** <https://community.doppler.com/t/authenticating-to-github-using-docker-login/1431>\
**Category:** Need Help\
**Created:** [January 2, 2024, 11:19pm UTC](https://community.doppler.com/t/authenticating-to-github-using-docker-login/1431 "2024-01-02T23:19:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Y.M.O](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/y.m.o/32/983_2.png) [@Y.M.O](https://community.doppler.com/u/Y.M.O)\
**Post date:** [January 2, 2024, 11:19pm UTC](https://community.doppler.com/t/authenticating-to-github-using-docker-login/1431/1 "2024-01-02T23:19:52Z")

</div>

Hi Folks

I am trying to authenticate to github using a github access token aka CR\_PAT. This is documented here [Working with the Container registry - GitHub Docs](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry)

I am wondering if there is a way to make that work using doppler. Here is what i tried but its failing with :  
Error: Cannot perform an interactive login from a non TTY device

```auto
  doppler run -p local-env -c dev -- echo $GITHUB_TOKEN | docker login ghcr.io -u myuser --password-stdin

```

BEst Regards

---

<div class="post-metadata">

**Author:** ![watsonian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/watsonian/32/267_2.png) [@watsonian](https://community.doppler.com/u/watsonian)\
**Post date:** [January 3, 2024, 6:41pm UTC](https://community.doppler.com/t/authenticating-to-github-using-docker-login/1431/2 "2024-01-03T18:41:02Z")

</div>

Hi @Y.M.O!

Welcome to the Doppler Community!

The “Error: Cannot perform an interactive login from a non TTY device” error you’re getting happens when you use `--password-stdin` with `docker login` but don’t actually pass a password in. The reason this is happening is that you’re attempting to reference an environment variable the Doppler CLI is injecting in the command it’s executing. You can do this, but not using the typical `--` syntax. You’ll need to use `--command` like this:

```auto
doppler run -p local-env -c dev --command 'echo $GITHUB_TOKEN | docker login ghcr.io -u myuser --password-stdin'

```

Could you give that a shot and see if it works?

Regards,  
-Joel

---

<div class="post-metadata">

**Author:** ![Y.M.O](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/y.m.o/32/983_2.png) [@Y.M.O](https://community.doppler.com/u/Y.M.O)\
**Post date:** [January 3, 2024, 9:39pm UTC](https://community.doppler.com/t/authenticating-to-github-using-docker-login/1431/3 "2024-01-03T21:39:08Z")

</div>

Hi @watsonian

Thank you for jumping on this. I tried creating a TEST env variable just in case my shell was being weird and it comes back empty.

Also if there is a better way to accomplish this than using this echo command i would appreciate. I like that doppler passes the variables directly to the process being started. But i canrt figure how to do that in this case

```auto

doppler run -p local-env -c dev --command "echo ${TEST} "

```

---

<div class="post-metadata">

**Author:** ![Y.M.O](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/y.m.o/32/983_2.png) [@Y.M.O](https://community.doppler.com/u/Y.M.O)\
**Post date:** [January 3, 2024, 9:41pm UTC](https://community.doppler.com/t/authenticating-to-github-using-docker-login/1431/4 "2024-01-03T21:41:09Z")

</div>

I tried this as well with no success

```auto
doppler run -p local-env -c dev --command 'bash -c "echo ${TEST}"'

```

---

<div class="post-metadata">

**Author:** ![Y.M.O](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/y.m.o/32/983_2.png) [@Y.M.O](https://community.doppler.com/u/Y.M.O)\
**Post date:** [January 3, 2024, 9:52pm UTC](https://community.doppler.com/t/authenticating-to-github-using-docker-login/1431/5 "2024-01-03T21:52:59Z")

</div>

HEre is the debug output log when i pass --debug

```auto
 -→ doppler run -p local-env -c dev --debug --command 'bash -c "echo ${TEST}"'
Debug: Using config dir /home/my-user/.doppler
Debug: Using config file /home/my-user/.doppler/.doppler.yaml
Debug: Reading config file
Debug: Skipping CLI upgrade check due to disallowed command
Debug: Retrieving token from system keyring
Debug: Sending anonmy-userus analytics payload: '{"command":"doppler.run"}'
Debug: Performing HTTP POST to https://cli.doppler.com/v1/analytics
Debug: Using metadata file /home/my-user/.doppler/fallback/.metadata-c230865338d15171ce654737a383f212d92337862386fc149eb4d34ec78801f2.json
Debug: Reading metadata file /home/my-user/.doppler/fallback/.metadata-c230865338d15171ce654737a383f212d92337862386fc149eb4d34ec78801f2.json
Debug: Performing HTTP GET to https://api.doppler.com/v3/configs/config/secrets/download?config=dev&format=json&include_dynamic_secrets=true&project=local-env
Debug: Request ID 959a8334-5e91-44ae-a99e-0e6edb3b41a6
Debug: Using cached secrets from fallback file
Debug: Using fallback file for cache /home/my-user/.doppler/fallback/.secrets-c230865338d15171ce654737a383f212d92337862386fc149eb4d34ec78801f2.json
Debug: Decrypting cache file
Debug: Parsing encrypted file version 4
Debug: PBKDF2 key derivation used 500000 rounds and took 84 ms

```

---

<div class="post-metadata">

**Author:** ![watsonian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/watsonian/32/267_2.png) [@watsonian](https://community.doppler.com/u/watsonian)\
**Post date:** [January 3, 2024, 10:17pm UTC](https://community.doppler.com/t/authenticating-to-github-using-docker-login/1431/6 "2024-01-03T22:17:13Z")

</div>

@Y.M.O You need to use single quotes like this:

```auto
doppler run -p local-env -c dev --command 'echo ${TEST}'

```

By using double-quotes, you’re causing bash to attempt to resolve the variable before the CLI injects the secret. Using single quotes will delay evaluation until the `echo` command is run.

---

<div class="post-metadata">

**Author:** ![Y.M.O](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/y.m.o/32/983_2.png) [@Y.M.O](https://community.doppler.com/u/Y.M.O)\
**Post date:** [January 3, 2024, 11:23pm UTC](https://community.doppler.com/t/authenticating-to-github-using-docker-login/1431/7 "2024-01-03T23:23:16Z")

</div>

Not much difference with single quotes

```auto
 -→ doppler run -p local-env -c dev --command 'echo tt ${TEST}'
tt

```

---

<div class="post-metadata">

**Author:** ![watsonian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/watsonian/32/267_2.png) [@watsonian](https://community.doppler.com/u/watsonian)\
**Post date:** [January 17, 2024, 6:12pm UTC](https://community.doppler.com/t/authenticating-to-github-using-docker-login/1431/8 "2024-01-17T18:12:13Z")

</div>

@Y.M.O If you run `doppler secrets get TEST -p local-env -c dev`, does the secret print out as expected? This should definitely work if the secret actually has a value as you can see here:

```auto
❯ doppler run -p example -c dev --command 'echo tt ${PORT}'
tt 8082

```

vs the output you get with double-quotes:

```auto
❯ doppler run -p example -c dev --command "echo tt ${PORT}"
tt

```
