What are the exit codes for docker CLI?

I have docker CLI commands in a shell script (docker login, docker build, etc.). In the script I’m testing the return value for success (“if [ $? != 0 ]” in bash) but it seems to return 0 even when the login failed. I don’t see return values in the docker CLI docs. Is there a document describing return codes?