-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(docker): authenticate using DockerHub credentials #2548
feat(docker): authenticate using DockerHub credentials #2548
Conversation
"type": "shell", | ||
"scripts": [ | ||
"{{template_dir}}/scripts/installers/docker-compose.sh", | ||
"{{template_dir}}/scripts/installers/docker-moby.sh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I intentionally moved these scripts into their own provisioner block so that the DockerHub credentials were not exposed to any other unrelated setup scripts.
# Always attempt to logout so we do not leave our credentials on the built image. | ||
docker logout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my testing docker logout
will not return a non-zero exit code even if you never logged into DockerHub. Therefore I believe it's safe/safer to always call it in this script.
This PR only adds support for Ubuntu. My team only works with Ubuntu at the moment, so we're only focused on getting authentication working for that use case. In the future we will look into ensuring this works for Windows builds. |
Hi @hutson! |
/azp run ubuntu1604, ubuntu1804, ubuntu2004 |
Azure Pipelines successfully started running 3 pipeline(s). |
Ubuntu builds, by default, pull images anonymously from the official DockerHub. DockerHub rate limits requests from anonymous and unpaid accounts: - https://docs.docker.com/docker-hub/download-rate-limit/ When those rate limits are reached the Packer build will fail with an error indicated the rate limit has been reached. Add support for providing credentials for a paid account that can be used by the Docker setup steps to authenticate when pulling images from DockerHub, thereby avoiding the rate limit. Related to #2094
Pull request has been rebased on top of the latest from |
Ubuntu builds, by default, pull images anonymously from the
official DockerHub. DockerHub rate limits requests from
anonymous and unpaid accounts:
When those rate limits are reached the Packer build will
fail with an error indicated the rate limit has been
reached.
Add support for providing credentials for a paid
account that can be used by the Docker setup steps to
authenticate when pulling images from DockerHub, thereby
avoiding the rate limit.
Related to #2094