how can I login to docker hub via Vagrant docker provisioner

I’ve read this documentation

I have a question what is the correct way to login via vagrant to docker hub?

  • Keeping Docker container alive running Java application
  • Containers can't connect to each other in swarm mode in multi-host environment
  • docker - Restrictions regarding naming image
  • How to enable colors in a Docker container?
  • Location of docker images downloaded by Docker (1.9.1) on Mac OS X
  • How to log in gcloud with a dockerfile
  • config.vm.provision "docker" do |d|
      d.login <- doesn't exist
      d.username <- doesn't exist
    end
    

    so, I think I need help.
    Does anybody know how should I do that?

    Thanks.

  • How to run Python Flask within a Docker container [duplicate]
  • Error while run Sphinx search service
  • How to stop the client IP address getting lost in a Cloudflare/Docker/NGINX/LAMP site?
  • Does docker run -v or Dockerfile VOLUME take precedence?
  • How to connect to a docker container from outside the host (same network) [OSX 10.11]
  • How can i keep crontab in file in ubuntu docker
  • 3 Solutions collect form web for “how can I login to docker hub via Vagrant docker provisioner”

    I could not find a way using the Vagrant docs so did the following:

    Vagrant.configure(2) do |config|
      config.vm.box = "hashicorp/precise64"
      #provision with docker
      config.vm.provision "docker"
    
      # login to docker
      config.vm.provision "shell", inline: "docker login -e donald@trump.com -p mexican_wall -u donald_trump"
    
      # then run your docker config
      config.vm.provision "docker" do |d|
        d.run "ubuntu"
      end
    end
    

    Are you using the proper vagrant version?

    Try

    Vagrant.configure("2") do |config|
      config.vm.provision "docker" do |d|
        d.email = ""
        d.username = ""
        d.password = ""
      end
    end
    

    It looks like you want to use d.email rather than login in this case. Not super familiar with Vagrant’s docker provisioner, but the four parameters provided for access to a repository are email, username, password, and auth_server.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.