Docker Hub auto-login

Hello,

I have few docker images residing in private repositories of Docker Hub. How can I force Rancher OS docker to auto-login to my Docker Hub account while booting via iPXE / cloud config? What is the best practice to do this?

Please help, thanks.

Karel

I will reply to myself. I am just generating /home/rancher/.docker/config.json in cloud config:

`write_files:

  • path: /home/rancher/.docker/config.json
    permissions: "0660"
    encoding: b64
    content: …`

Unfortunately this trick does not apply when I want to use private images to bootstrap services.

Nothing works (tried to put this file to /.docker/config.json, /home/docker/.docker/config.json, /root/.docker/config.json, nothing works.

I am desperate. This stuff is unusable.

I haven’t tried it myself, but have you looked at this documentation? It’s how to add in certificates for private registries, but not sure how it would work for dockerhub…

http://docs.rancher.com/os/configuration/docker/#certificates-for-private-registries

Hello,

that would work if Docker Hub supported certificates. But I have to login using the docker login command and my username/password to access my private repositories. This information is then stored in ~/.docker/config.json, co creating this file is equivalent to using the command. But this does not seem to work when launching services from cloud-config.