'How to pass Docker credentials to `docker.login` in Salt?

I am trying to use this code snippet to login to DockerHub in Salt:

docker.login
  module.run:
    - registries:
      - hub

How do I pass proper Docker credentials here so that the minion can login to DockerHub? Additionally I'll be using a Docker token to log-in since I have two-factor authentication enabled in the DockerHub account.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source