How can I tell whether or not I\'m logged in to a private Docker registry server from a script? In other words, has docker login some.registry.com
been run success
When you do the
Docker login -u -p
command from your terminal, you will have a response: (stored in $?)
0
Login Succeeded
if you were successful.
In your shell script, you could just look at the response you're receiving, if it does not equal 0, you've failed to login.
sudo docker login -u -p
if [ $? -ne 0 ]; then
echo Login failed!
else
echo Login OK!
fi