mirror of
https://github.com/actions/runner-images.git
synced 2026-01-08 11:20:25 +08:00
[ubuntu] feat(docker): authenticate using DockerHub credentials (#2548)
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
This commit is contained in:
@@ -20,7 +20,9 @@
|
||||
"capture_name_prefix": "packer",
|
||||
"image_version": "dev",
|
||||
"image_os": "ubuntu20",
|
||||
"run_validation_diskspace": "false"
|
||||
"run_validation_diskspace": "false",
|
||||
"dockerhub_login": "{{env `DOCKERHUB_LOGIN`}}",
|
||||
"dockerhub_password": "{{env `DOCKERHUB_PASSWORD`}}"
|
||||
},
|
||||
"sensitive-variables": [
|
||||
"client_secret"
|
||||
@@ -169,6 +171,20 @@
|
||||
],
|
||||
"execute_command": "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"scripts": [
|
||||
"{{template_dir}}/scripts/installers/docker-compose.sh",
|
||||
"{{template_dir}}/scripts/installers/docker-moby.sh"
|
||||
],
|
||||
"environment_vars": [
|
||||
"HELPER_SCRIPTS={{user `helper_script_folder`}}",
|
||||
"INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}",
|
||||
"DOCKERHUB_LOGIN={{user `dockerhub_login`}}",
|
||||
"DOCKERHUB_PASSWORD={{user `dockerhub_password`}}"
|
||||
],
|
||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"scripts": [
|
||||
@@ -184,8 +200,6 @@
|
||||
"{{template_dir}}/scripts/installers/cmake.sh",
|
||||
"{{template_dir}}/scripts/installers/codeql-bundle.sh",
|
||||
"{{template_dir}}/scripts/installers/containers.sh",
|
||||
"{{template_dir}}/scripts/installers/docker-compose.sh",
|
||||
"{{template_dir}}/scripts/installers/docker-moby.sh",
|
||||
"{{template_dir}}/scripts/installers/dotnetcore-sdk.sh",
|
||||
"{{template_dir}}/scripts/installers/erlang.sh",
|
||||
"{{template_dir}}/scripts/installers/firefox.sh",
|
||||
@@ -357,4 +371,4 @@
|
||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user