Skip to content

Commit 3f79054

Browse files
authored
feat: Add /certs/client and docker.sock to volumes for docker in docker (#396)
* Adding /certs/client and docker.sock to volumes for docker in docker * Make the volumes for docker-in-docker configurable * Format code and add documentation * Remove whitespaces in `runners_additional_volumes` if Dind volumes are added * Add /builds to the volume mount to have everything available inside docker Co-authored-by: kayma <[email protected]>
1 parent 19bdf5c commit 3f79054

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ terraform destroy
397397
| <a name="input_runners_additional_volumes"></a> [runners\_additional\_volumes](#input\_runners\_additional\_volumes) | Additional volumes that will be used in the runner config.toml, e.g Docker socket | `list(any)` | `[]` | no |
398398
| <a name="input_runners_concurrent"></a> [runners\_concurrent](#input\_runners\_concurrent) | Concurrent value for the runners, will be used in the runner config.toml. | `number` | `10` | no |
399399
| <a name="input_runners_disable_cache"></a> [runners\_disable\_cache](#input\_runners\_disable\_cache) | Runners will not use local cache, will be used in the runner config.toml | `bool` | `false` | no |
400+
| <a name="input_runners_add_dind_volumes"></a> [runners\_add\_dind\_volumes](#input\_runners\_add\_dind\_volumes) | Add certificates and docker.sock to the volumes to support docker-in-docker (dind) | `bool` | `false` | no |
400401
| <a name="input_runners_docker_runtime"></a> [runners\_docker\_runtime](#input\_runners\_docker\_runtime) | docker runtime for runners, will be used in the runner config.toml | `string` | `""` | no |
401402
| <a name="input_runners_ebs_optimized"></a> [runners\_ebs\_optimized](#input\_runners\_ebs\_optimized) | Enable runners to be EBS-optimized. | `bool` | `true` | no |
402403
| <a name="input_runners_environment_vars"></a> [runners\_environment\_vars](#input\_runners\_environment\_vars) | Environment variables during build execution, e.g. KEY=Value, see runner-public example. Will be used in the runner config.toml | `list(string)` | `[]` | no |

locals.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ locals {
1717
name_sg = var.overrides["name_sg"] == "" ? local.tags["Name"] : var.overrides["name_sg"]
1818
name_iam_objects = lookup(var.overrides, "name_iam_objects", "") == "" ? local.tags["Name"] : var.overrides["name_iam_objects"]
1919
runners_additional_volumes = <<-EOT
20-
%{~for volume in var.runners_additional_volumes~},"${volume}"%{endfor~}
20+
%{~if var.runners_add_dind_volumes~},"/certs/client", "/builds", "/var/run/docker.sock:/var/run/docker.sock"%{endif~}%{~for volume in var.runners_additional_volumes~},"${volume}"%{endfor~}
2121
EOT
2222

2323
runners_machine_autoscaling = templatefile("${path.module}/template/runners_machine_autoscaling.tpl", {

variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ variable "runners_disable_cache" {
183183
default = false
184184
}
185185

186+
variable "runners_add_dind_volumes" {
187+
description = "Add certificates and docker.sock to the volumes to support docker-in-docker (dind)"
188+
type = bool
189+
default = false
190+
}
191+
186192
variable "runners_additional_volumes" {
187193
description = "Additional volumes that will be used in the runner config.toml, e.g Docker socket"
188194
type = list(any)

0 commit comments

Comments
 (0)