From 4e79a9c1517489ee920b9e809205855d2ee5f3af Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Tue, 8 Nov 2022 14:35:39 +0000 Subject: [PATCH] chore: Unify Docker terraform templates Changes to terraform templates: * Remove DNS (this can interfere with users running their own DNS servers) * Remove `lower()` restriction from hostnames so that it will show the name set by the user, as-is (there is no restriction on upper case letters in hostnames) * Remove superfluous `trap` in entrypoints, this is already handled by the init script * Switch from `command` to `entrypoint` as the latter can support more Docker images out-of-the-box --- dogfood/main.tf | 14 +++----------- examples/templates/docker-code-server/main.tf | 6 +++--- examples/templates/docker-image-builds/main.tf | 7 +++---- examples/templates/docker-with-dotfiles/main.tf | 9 +++++---- examples/templates/docker/main.tf | 13 +++---------- 5 files changed, 17 insertions(+), 32 deletions(-) diff --git a/dogfood/main.tf b/dogfood/main.tf index f39ccc491e8e0..f25e3069d4b68 100644 --- a/dogfood/main.tf +++ b/dogfood/main.tf @@ -90,19 +90,11 @@ resource "docker_image" "dogfood" { resource "docker_container" "workspace" { count = data.coder_workspace.me.start_count image = docker_image.dogfood.name - # Uses lower() to avoid Docker restriction on container names. - name = local.container_name + name = local.container_name # Hostname makes the shell more user friendly: coder@my-workspace:~$ - hostname = lower(data.coder_workspace.me.name) - dns = ["1.1.1.1"] + hostname = data.coder_workspace.me.name # Use the docker gateway if the access URL is 127.0.0.1 - command = [ - "sh", "-c", - <