Skip to content

Commit

Permalink
[ubicloud] Add custom docker configuration
Browse files Browse the repository at this point in the history
Moving these steps to image generation to speed up provisioning

ubicloud/ubicloud#2371
  • Loading branch information
enescakir committed Jan 9, 2025
1 parent 328a891 commit 982da8a
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 0 deletions.
18 changes: 18 additions & 0 deletions images/ubuntu/scripts/ubicloud/configure-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash -xe

DEFAULT_DOCKER_CONFIG='{
"experimental": false,
"dns-opts": [
"attempts:3"
]
}'

if [ -f "/etc/docker/daemon.json" ]; then
existing_config=$(sudo cat /etc/docker/daemon.json)
else
existing_config="{}"
fi

echo "$existing_config" | jq ". += $DEFAULT_DOCKER_CONFIG" | sudo tee /etc/docker/daemon.json

sudo systemctl restart docker
1 change: 1 addition & 0 deletions images/ubuntu/templates/ubuntu-20.04.arm64.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ build {
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = [
"${path.root}/../scripts/ubicloud/setup-runner-user.sh",
"${path.root}/../scripts/ubicloud/configure-docker.sh",
"${path.root}/../scripts/ubicloud/install-cache-proxy.sh"
]
}
Expand Down
1 change: 1 addition & 0 deletions images/ubuntu/templates/ubuntu-20.04.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ build {
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = [
"${path.root}/../scripts/ubicloud/setup-runner-user.sh",
"${path.root}/../scripts/ubicloud/configure-docker.sh",
"${path.root}/../scripts/ubicloud/install-cache-proxy.sh"
]
}
Expand Down
1 change: 1 addition & 0 deletions images/ubuntu/templates/ubuntu-22.04.arm64.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ build {
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = [
"${path.root}/../scripts/ubicloud/setup-runner-user.sh",
"${path.root}/../scripts/ubicloud/configure-docker.sh",
"${path.root}/../scripts/ubicloud/install-cache-proxy.sh"
]
}
Expand Down
1 change: 1 addition & 0 deletions images/ubuntu/templates/ubuntu-22.04.gpu.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ build {
"${path.root}/../scripts/ubicloud/nvidia-driver.sh",
"${path.root}/../scripts/ubicloud/nvidia-container-toolkit.sh",
"${path.root}/../scripts/ubicloud/setup-runner-user.sh",
"${path.root}/../scripts/ubicloud/configure-docker.sh",
"${path.root}/../scripts/ubicloud/install-cache-proxy.sh",
"${path.root}/../scripts/ubicloud/install-packages.sh",
"${path.root}/../scripts/ubicloud/generalize-image.sh"
Expand Down
1 change: 1 addition & 0 deletions images/ubuntu/templates/ubuntu-22.04.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ build {
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = [
"${path.root}/../scripts/ubicloud/setup-runner-user.sh",
"${path.root}/../scripts/ubicloud/configure-docker.sh",
"${path.root}/../scripts/ubicloud/install-cache-proxy.sh"
]
}
Expand Down
1 change: 1 addition & 0 deletions images/ubuntu/templates/ubuntu-24.04.arm64.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ provisioner "shell" {
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = [
"${path.root}/../scripts/ubicloud/setup-runner-user.sh",
"${path.root}/../scripts/ubicloud/configure-docker.sh",
"${path.root}/../scripts/ubicloud/install-cache-proxy.sh",
"${path.root}/../scripts/ubicloud/install-packages.sh",
"${path.root}/../scripts/ubicloud/generalize-image.sh"
Expand Down
1 change: 1 addition & 0 deletions images/ubuntu/templates/ubuntu-24.04.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ provisioner "shell" {
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = [
"${path.root}/../scripts/ubicloud/setup-runner-user.sh",
"${path.root}/../scripts/ubicloud/configure-docker.sh",
"${path.root}/../scripts/ubicloud/install-cache-proxy.sh",
"${path.root}/../scripts/ubicloud/install-packages.sh",
"${path.root}/../scripts/ubicloud/generalize-image.sh"
Expand Down

0 comments on commit 982da8a

Please sign in to comment.