From dc01c37dc5ade2ec2616023f0aa829c32a5f1018 Mon Sep 17 00:00:00 2001 From: Shamil Mubarakshin Date: Thu, 8 Jan 2026 12:45:08 +0100 Subject: [PATCH] [ubuntu-22.04] Remove cached docker images --- images/ubuntu/scripts/build/install-docker.sh | 24 ------------------- .../docs-gen/Generate-SoftwareReport.ps1 | 3 --- images/ubuntu/scripts/tests/Tools.Tests.ps1 | 8 ------- .../templates/build.ubuntu-22_04.pkr.hcl | 2 +- .../templates/build.ubuntu-24_04.pkr.hcl | 2 +- .../ubuntu/templates/variable.ubuntu.pkr.hcl | 8 ------- images/ubuntu/toolsets/toolset-2204.json | 17 ------------- images/ubuntu/toolsets/toolset-2404.json | 2 -- 8 files changed, 2 insertions(+), 64 deletions(-) diff --git a/images/ubuntu/scripts/build/install-docker.sh b/images/ubuntu/scripts/build/install-docker.sh index 35b55f288..9811b938a 100644 --- a/images/ubuntu/scripts/build/install-docker.sh +++ b/images/ubuntu/scripts/build/install-docker.sh @@ -64,27 +64,6 @@ systemctl is-enabled --quiet docker.service || systemctl enable docker.service sleep 10 docker info -if [[ "${DOCKERHUB_PULL_IMAGES:-yes}" == "yes" ]]; then - # If credentials are provided, attempt to log into Docker Hub - # with a paid account to avoid Docker Hub's rate limit. - if [[ "${DOCKERHUB_LOGIN}" ]] && [[ "${DOCKERHUB_PASSWORD}" ]]; then - docker login --username "${DOCKERHUB_LOGIN}" --password "${DOCKERHUB_PASSWORD}" - fi - - # Pull images - images=$(get_toolset_value '.docker.images[]') - for image in $images; do - docker pull "$image" - done - - # Always attempt to logout so we do not leave our credentials on the built - # image. Logout _should_ return a zero exit code even if no credentials were - # stored from earlier. - docker logout -else - echo "Skipping docker images pulling" -fi - # Download amazon-ecr-credential-helper aws_latest_release_url="https://api.github.com/repos/awslabs/amazon-ecr-credential-helper/releases/latest" aws_helper_url=$(curl -fsSL "${aws_latest_release_url}" | jq -r '.body' | awk -F'[()]' '/linux-amd64/ {print $2}') @@ -102,6 +81,3 @@ rm $GPG_KEY rm $REPO_PATH invoke_tests "Tools" "Docker" -if [[ "${DOCKERHUB_PULL_IMAGES:-yes}" == "yes" ]]; then - invoke_tests "Tools" "Docker images" -fi diff --git a/images/ubuntu/scripts/docs-gen/Generate-SoftwareReport.ps1 b/images/ubuntu/scripts/docs-gen/Generate-SoftwareReport.ps1 index c138501bc..4f4be1bee 100644 --- a/images/ubuntu/scripts/docs-gen/Generate-SoftwareReport.ps1 +++ b/images/ubuntu/scripts/docs-gen/Generate-SoftwareReport.ps1 @@ -254,9 +254,6 @@ $androidTools.AddTable($(Build-AndroidTable)) $androidTools.AddHeader("Environment variables").AddTable($(Build-AndroidEnvironmentTable)) -if (-not $(Test-IsUbuntu24)) { - $installedSoftware.AddHeader("Cached Docker images").AddTable($(Get-CachedDockerImagesTableData)) -} $installedSoftware.AddHeader("Installed apt packages").AddTable($(Get-AptPackages)) $softwareReport.ToJson() | Out-File -FilePath "${OutputDirectory}/software-report.json" -Encoding UTF8NoBOM diff --git a/images/ubuntu/scripts/tests/Tools.Tests.ps1 b/images/ubuntu/scripts/tests/Tools.Tests.ps1 index a85d88dff..3200cef29 100644 --- a/images/ubuntu/scripts/tests/Tools.Tests.ps1 +++ b/images/ubuntu/scripts/tests/Tools.Tests.ps1 @@ -113,14 +113,6 @@ Describe "Docker" { } } -Describe "Docker images" { - $testCases = (Get-ToolsetContent).docker.images | ForEach-Object { @{ ImageName = $_ } } - - It "" -TestCases $testCases { - sudo docker images "$ImageName" --format "{{.Repository}}" | Should -Not -BeNullOrEmpty - } -} - Describe "Ansible" { It "Ansible" { "ansible --version" | Should -ReturnZeroExitCode diff --git a/images/ubuntu/templates/build.ubuntu-22_04.pkr.hcl b/images/ubuntu/templates/build.ubuntu-22_04.pkr.hcl index e306c9e74..135af613f 100644 --- a/images/ubuntu/templates/build.ubuntu-22_04.pkr.hcl +++ b/images/ubuntu/templates/build.ubuntu-22_04.pkr.hcl @@ -162,7 +162,7 @@ build { } provisioner "shell" { - environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}", "DOCKERHUB_LOGIN=${var.dockerhub_login}", "DOCKERHUB_PASSWORD=${var.dockerhub_password}"] + environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"] execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" scripts = ["${path.root}/../scripts/build/install-docker.sh"] } diff --git a/images/ubuntu/templates/build.ubuntu-24_04.pkr.hcl b/images/ubuntu/templates/build.ubuntu-24_04.pkr.hcl index 781fcccf9..04dd1114e 100644 --- a/images/ubuntu/templates/build.ubuntu-24_04.pkr.hcl +++ b/images/ubuntu/templates/build.ubuntu-24_04.pkr.hcl @@ -151,7 +151,7 @@ provisioner "shell" { } provisioner "shell" { - environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}", "DOCKERHUB_PULL_IMAGES=NO"] + environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"] execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" scripts = ["${path.root}/../scripts/build/install-docker.sh"] } diff --git a/images/ubuntu/templates/variable.ubuntu.pkr.hcl b/images/ubuntu/templates/variable.ubuntu.pkr.hcl index ef48d309d..685c6604b 100644 --- a/images/ubuntu/templates/variable.ubuntu.pkr.hcl +++ b/images/ubuntu/templates/variable.ubuntu.pkr.hcl @@ -132,14 +132,6 @@ variable "winrm_username" { // The username used to connect to the VM vi } // Image related variables -variable "dockerhub_login" { - type = string - default = "${env("DOCKERHUB_LOGIN")}" -} -variable "dockerhub_password" { - type = string - default = "${env("DOCKERHUB_PASSWORD")}" -} variable "helper_script_folder" { type = string default = "/imagegeneration/helpers" diff --git a/images/ubuntu/toolsets/toolset-2204.json b/images/ubuntu/toolsets/toolset-2204.json index 84645a53c..076bb9743 100644 --- a/images/ubuntu/toolsets/toolset-2204.json +++ b/images/ubuntu/toolsets/toolset-2204.json @@ -214,23 +214,6 @@ "brew": [ ], "docker": { - "images": [ - "alpine:3.16", - "alpine:3.17", - "alpine:3.18", - "alpine:3.19", - "debian:10", - "debian:11", - "moby/buildkit:latest", - "node:18", - "node:20", - "node:22", - "node:18-alpine", - "node:20-alpine", - "node:22-alpine", - "ubuntu:20.04", - "ubuntu:22.04" - ], "components": [ { "package": "containerd.io", diff --git a/images/ubuntu/toolsets/toolset-2404.json b/images/ubuntu/toolsets/toolset-2404.json index 00392195c..b6150b0f3 100644 --- a/images/ubuntu/toolsets/toolset-2404.json +++ b/images/ubuntu/toolsets/toolset-2404.json @@ -191,8 +191,6 @@ "brew": [ ], "docker": { - "images": [ - ], "components": [ { "package": "containerd.io",