Dokku deploy getting "429 Too Many Requests"

Sad times when trying to get things into production

I use Dokku in production, on a 6$ per month DigitalOcean machine to run my services. Today, it happened to me that suddenly deployments started failing when pushing to the repository on the Dokku machine. Specifically, the server tried pulling Docker images and got “429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit.”.

This is likely caused by the fact that my machine’s IP address is shared with others on DigitalOcean’s network. If another machine is also pulling Docker images, you get into trouble.

Here is how to fix that:

  1. Create an account on Docker Hub.

  2. In the right top corner, go to “Account settings”.

  3. Under the “Security” section, go to “Personal access tokens”.

  4. Click on “Generate new token”.

  5. Login to your machine as root and execute “su - dokku”.

  6. Execute “docker login -u the-dockerhub-username” and input the password that you got to see when generating the Personal Access Token.

After the above, /home/dokku/.docker/config.json will be created with the correct credentials and deployments should work again. I hope this saves someone a bit of time. If it did, consider subscribing to my newsletter where I share tips on building your own indie SaaS products :).