fix(examples): add keep_locally to docker_image resources (#16012)

Fixes https://github.com/coder/coder/issues/15972

Adds `keep_locally = true` to other templates that use the
`docker_image` resource to prevent the docker provider from attempting
to remove the image upon workspace deletion.

We had set this in some other places (such as the `dogfood` template)
but had not set this consistently in other templates.
This commit is contained in:
Cian Johnston
2025-01-02 13:17:53 +00:00
committed by GitHub
parent f3fe3bc785
commit 9c625476b7
3 changed files with 4 additions and 1 deletions
+1
View File
@@ -144,6 +144,7 @@ resource "docker_image" "main" {
triggers = { triggers = {
dir_sha1 = sha1(join("", [for f in fileset(path.module, "build/*") : filesha1("${path.module}/${f}")])) dir_sha1 = sha1(join("", [for f in fileset(path.module, "build/*") : filesha1("${path.module}/${f}")]))
} }
keep_locally = true
} }
resource "docker_container" "workspace" { resource "docker_container" "workspace" {
+1
View File
@@ -92,6 +92,7 @@ resource "docker_image" "main" {
triggers = { triggers = {
dir_sha1 = sha1(join("", [for f in fileset(path.module, "build/*") : filesha1(f)])) dir_sha1 = sha1(join("", [for f in fileset(path.module, "build/*") : filesha1(f)]))
} }
keep_locally = true
} }
resource "docker_container" "workspace" { resource "docker_container" "workspace" {
@@ -154,7 +154,8 @@ data "local_sensitive_file" "cache_repo_dockerconfigjson" {
} }
resource "docker_image" "devcontainer_builder_image" { resource "docker_image" "devcontainer_builder_image" {
name = local.devcontainer_builder_image name = local.devcontainer_builder_image
keep_locally = true
} }
resource "docker_volume" "workspaces" { resource "docker_volume" "workspaces" {