How can I tell if I'm logged in to a private Docker registry from a script?
<p>How can I tell whether or not I'm logged in to a private Docker registry server from a script?  In other words, has <code>docker login some.registry.com</code> been run successfully (and is still valid)?</p>

<p>Note: I'm asking about an arbitrary private registry, not the <code>docker.io</code> registry.</p>