Check out example codes for "docker login procedure". It will help you in understanding the concepts better.

Code Example 1

$ echo $DOCKER_PASS | docker login -u$DOCKER_USER --password-stdin $DOCKER_HOST

Learn ReactJs, React Native from akashmittal.com