# Unable to log in to docker hub

**URL:** <https://travis-ci.community/t/unable-to-log-in-to-docker-hub/10070>\
**Category:** Environments\
**Created:** [October 3, 2020, 5:23am UTC](https://travis-ci.community/t/unable-to-log-in-to-docker-hub/10070 "2020-10-03T05:23:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChanManChan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/chanmanchan/32/5260_2.png) [@ChanManChan](https://travis-ci.community/u/ChanManChan)\
**Post date:** [October 3, 2020, 5:23am UTC](https://travis-ci.community/t/unable-to-log-in-to-docker-hub/10070/1 "2020-10-03T05:23:25Z")

</div>

![travis-doubt](https://us1.discourse-cdn.com/flex015/uploads/travis_ci/original/2X/b/b5a30bb8d9f406227b476f9831c1d14420269af1.jpeg)

I have tried  
- echo “$DOCKER\_PASSWORD” | docker login -u “$DOCKER\_USERNAME” --password-stdin  
and  
- docker login -u $DOCKER\_USERNAME -p $DOCKER\_PASSWORD  
and both of them are giving the same error.

Link :- [https://travis-ci.org/github/ChanManChan/multi-container](https://travis-ci.org/github/ChanManChan/multi-container)

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [October 5, 2020, 4:30am UTC](https://travis-ci.community/t/unable-to-log-in-to-docker-hub/10070/2 "2020-10-05T04:30:17Z")

</div>

Try:  
`docker logout`  
Then pull again.

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [October 6, 2020, 3:47pm UTC](https://travis-ci.community/t/unable-to-log-in-to-docker-hub/10070/3 "2020-10-06T15:47:11Z")

</div>

What is in your `$DOCKER_PASSWORD`? Does it contain `bash`-special characters that may be throwing off `docker login`?

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [October 7, 2020, 11:02am UTC](https://travis-ci.community/t/unable-to-log-in-to-docker-hub/10070/4 "2020-10-07T11:02:46Z")

</div>

One more possible reason. You specify the secret variables using repository settings. In this case, you need to paste the variable’s raw value into the settings, not an encoded string generated by `travis encrypt`. This is a mistake that new users sometimes make.

To double-check if a secret variable’s value is correct, you can print a small part of it and then delete the build’s log. E.g. this will print the first 3 characters:

```auto
echo "${VAR:0:3}"

```

---

<div class="post-metadata">

**Author:** ![ChanManChan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/chanmanchan/32/5260_2.png) [@ChanManChan](https://travis-ci.community/u/ChanManChan)\
**Post date:** [October 10, 2020, 4:34pm UTC](https://travis-ci.community/t/unable-to-log-in-to-docker-hub/10070/5 "2020-10-10T16:34:53Z")

</div>

Thanks man, really good catch.
