In step 1, we used the Ansible module docker_login to log in to a Docker Registry, in our case, Docker Hub. We should note that docker_login uses Docker Hub as the default registry; that is, https://index.docker.io/v1/. We can change the Docker Registry to a privately-hosted Docker Registry by using an additional parameter: registry_url.
In step 2, we pushed a Docker image to a private Docker Registry. We should note that if we skip docker_login and try to push an image to Docker Hub, it will fail for private registries.