When you login you should also see a message indicating where your credentials are being stored, ~/.docker/config.json by default. As long as that file is not deleted you can simply run docker login and it will automatically reestablish your session. Although it shouldn't be needed after restarting the service or even the machine entirely. Unless you are using one of the credential helper methods as described in the documentation.