dockur / windows

Windows inside a Docker container.
MIT License
29.21k stars 1.99k forks source link

`C:\\oem\install.bat` not executing #677

Closed michael-sola closed 3 months ago

michael-sola commented 3 months ago

Operating system

Debian GNU/Linux trixie/sid

Description

Following these instructions, I mounted an install.bat script to the container's /oem directory:

kubectl exec test-windows-node-89bdbd548-swvdr -- ls /oem
install.bat

However, inside Windows it shows up as a directory:

ls C:\\oem

..2024_07_31_21_47_38.5111193299

The batch file is inside the directory, but the script never executes.

Detailed OS info:

# cat etc/os-release
PRETTY_NAME="Debian GNU/Linux trixie/sid"
NAME="Debian GNU/Linux"
VERSION_CODENAME=trixie
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"

# uname -a
Linux test-windows-node-5b5d6d8dcf-dmlqb 6.1.85+ #1 SMP PREEMPT_DYNAMIC Thu Jun 27 21:05:47 UTC 2024 x86_64 GNU/Linux

Docker compose

apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: "2024-07-31T21:41:54Z"
  generateName: test-windows-node-5c6bc968c-
  labels:
    app.kubernetes.io/instance: test
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: windows-node
    app.kubernetes.io/version: 1.16.0
    helm.sh/chart: windows-node-0.1.0
    pod-template-hash: 5c6bc968c
  name: test-windows-node-5c6bc968c-skpwc
  namespace: default
  ownerReferences:
  - apiVersion: apps/v1
    blockOwnerDeletion: true
    controller: true
    kind: ReplicaSet
    name: test-windows-node-5c6bc968c
    uid: 338035ae-909a-41f6-8c6f-e4854c781b68
  resourceVersion: "215427"
  uid: 316fc1ef-9fe2-4dfe-9daf-3b0948cb14c2
spec:
  containers:
  - env:
    - name: RAM_SIZE
      value: 4G
    - name: CPU_CORES
      value: "2"
    - name: DISK_SIZE
      value: 64G
    - name: VERSION
      value: win10
    image: dockurr/windows:3.12
    imagePullPolicy: IfNotPresent
    name: windows-node
    ports:
    - containerPort: 8006
      protocol: TCP
    - containerPort: 3389
      protocol: TCP
    - containerPort: 3389
      protocol: UDP
    resources: {}
    securityContext:
      capabilities:
        add:
        - NET_ADMIN
      privileged: true
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /oem
      name: oem
    - mountPath: /storage
      name: storage
    - mountPath: /dev/kvm
      name: dev-kvm
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: kube-api-access-k84xt
      readOnly: true
  dnsPolicy: ClusterFirst
  enableServiceLinks: true
  nodeName: gke-windows-cluster-default-pool-8cae251b-s1h3
  preemptionPolicy: PreemptLowerPriority
  priority: 0
  restartPolicy: Always
  schedulerName: default-scheduler
  securityContext: {}
  serviceAccount: test-windows-node
  serviceAccountName: test-windows-node
  terminationGracePeriodSeconds: 120
  tolerations:
  - effect: NoExecute
    key: node.kubernetes.io/not-ready
    operator: Exists
    tolerationSeconds: 300
  - effect: NoExecute
    key: node.kubernetes.io/unreachable
    operator: Exists
    tolerationSeconds: 300
  volumes:
  - configMap:
      defaultMode: 511
      name: test-windows-node-oem
    name: oem
  - name: storage
    persistentVolumeClaim:
      claimName: test-windows-node-storage
  - hostPath:
      path: /dev/kvm
      type: ""
    name: dev-kvm
  - name: kube-api-access-k84xt
    projected:
      defaultMode: 420
      sources:
      - serviceAccountToken:
          expirationSeconds: 3607
          path: token
      - configMap:
          items:
          - key: ca.crt
            path: ca.crt
          name: kube-root-ca.crt
      - downwardAPI:
          items:
          - fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
            path: namespace
status:
  conditions:
  - lastProbeTime: null
    lastTransitionTime: "2024-07-31T21:42:09Z"
    status: "True"
    type: PodReadyToStartContainers
  - lastProbeTime: null
    lastTransitionTime: "2024-07-31T21:41:58Z"
    status: "True"
    type: Initialized
  - lastProbeTime: null
    lastTransitionTime: "2024-07-31T21:42:09Z"
    status: "True"
    type: Ready
  - lastProbeTime: null
    lastTransitionTime: "2024-07-31T21:42:09Z"
    status: "True"
    type: ContainersReady
  - lastProbeTime: null
    lastTransitionTime: "2024-07-31T21:41:58Z"
    status: "True"
    type: PodScheduled
  containerStatuses:
  - containerID: containerd://4b6d73636534d53f2c5b2a82cfbd314d552acb069a0a9228c05c0add5262fe8a
    image: docker.io/dockurr/windows:3.12
    imageID: docker.io/dockurr/windows@sha256:07b8506acb60b800becb5e0a151a1da1c00bf60d28a819a52c2440f2a8ec3b05
    lastState: {}
    name: windows-node
    ready: true
    restartCount: 0
    started: true
    state:
      running:
        startedAt: "2024-07-31T21:42:09Z"
  hostIP: <readacted>
  hostIPs:
  - ip: <readacted>
  phase: Running
  podIP: <readacted>
  podIPs:
  - ip: <readacted>
  qosClass: BestEffort
  startTime: "2024-07-31T21:41:58Z"

Docker log

❯ Extracting Windows 10 image...
❯ Adding drivers to image...
❯ Adding OEM folder to image...
❯ Adding win10x64.xml for automatic installation...
❯ Building Windows 10 image...
Warning: creating filesystem that does not conform to ISO-9660.
genisoimage: Symlink /storage/tmp/unpack/sources/$OEM$/$1/oem/..data ignored - continuing.
genisoimage: Symlink /storage/tmp/unpack/sources/$OEM$/$1/oem/install.bat ignored - continuing.
❯ Creating a 64G growable disk image in raw format...
❯ Booting Windows using QEMU v8.2.4...

...

BdsDxe: failed to load Boot0002 "UEFI QEMU QEMU HARDDISK " from PciRoot(0x0)/Pci(0xA,0x0)/Scsi(0x0,0x0): Not Found
BdsDxe: loading Boot0001 "UEFI QEMU QEMU CD-ROM " from PciRoot(0x0)/Pci(0x5,0x0)/Scsi(0x0,0x0)
BdsDxe: starting Boot0001 "UEFI QEMU QEMU CD-ROM " from PciRoot(0x0)/Pci(0x5,0x0)/Scsi(0x0,0x0)

...

❯ Windows started succesfully, visit http://localhost:8006/ to view the screen...

Screenshots (optional)

Screenshot 2024-07-31 at 6 04 15 PM

michael-sola commented 3 months ago

This was an issue regarding how k8s mounts configmap volumes