Docker compose - no basic auth credentials

Dear All,
I have 2 scripts:

  1. docker-login.sh : SUCCEEDED
  2. start.sh : This has command docker-compose up -d

The scenario is I was running the scripts manually in AWS EC2 Linux and both works fine. The script start.sh pulls the docker images successfully. But when I am trying to automate via user data, docker-login is succeeded but docker-compose gives an error “no basic auth credentials” and it fails.

Docker version: docker-compose version 1.21.2, build a133471

Please advise as I would like to automate this as mentioned.

Thanks
Jasvinder