-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed as not planned
Labels
use-caseA novel and interesting way to use CoderA novel and interesting way to use Coder
Description
we've received requests for running windows containers as Coder workspaces. in my attempts to POC this use-case, i've run into issues with how containerd executes powershell commands/scripts as part of the entrypoint command in the kubernetes_pod spec in Terraform. related issue: containerd/containerd#5067
versions
- host: GCP Windows LTSC with containerd (Windows Server 2019 Datacenter)
- runtime:
containerd://1.6.13-gke.1 - k8s provider:
2.12.1
error
Error: failed to start containerd task "coder-container":
hcs::System::CreateProcess coder-container: The system cannot find the file specified.: unknowntests
1. execute powershell against the init_script terraform object
resource "kubernetes_pod" "main" {
container {
image = "docker.io/stefanscherer/node-windows:latest"
command = ["powershell.exe", "-NoExit", "-Command", coder_agent.main.init_script]
}
}2. mount the init_script as a volume, execute the file via powershell
resource "kubernetes_pod" "main" {
spec {
container {
image = "docker.io/stefanscherer/node-windows:latest"
command = ["powershell.exe", "-NoExit", "-Command", "C:\\coder_init\\init.ps1"]
}
volume_mount {
mount_path = "C:\\coder_init"
name = "coder-init-script"
}
volume {
name = "coder-init-script"
secret {
secret_name = "coder-init-script"
}
}
}
resource "kubernetes_secret" "init_script" {
metadata {
name = "coder-init-script"
namespace = "oss"
}
type = "Opaque"
data = {
"init.ps1" = base64encode(coder_agent.coder.init_script)
}
}3. set the SHELL & ENTRYPOINT in the Dockerfile
FROM stefanscherer/node-windows:latest
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENTRYPOINT ["powershell.exe"]resource "kubernetes_pod" "main" {
container {
image = "ericpaulsen/windows-test:latest"
command = ["C:\\coder_init\\init.ps1"]
}
}any feedback, troubleshooting ideas are appreciated.
matifali
Metadata
Metadata
Assignees
Labels
use-caseA novel and interesting way to use CoderA novel and interesting way to use Coder