Skip to content

Windows Guest

Namhyeon, Go edited this page Nov 14, 2024 · 25 revisions

Windows Guest on Docker (Linux Host)

  1. Download and create a combined ISO

    Extract the two ISO files and combine them into one ISO file. (e.g. win10_x64_virtio.iso)

    And then, load the drivers - vioscsi\w10\amd64(SCSI) and NetKVM\w10\amd64(Network) - when installing Windows 10

  2. Build the Docker image

    # git clone https://github.com/gnh1201/docker-qemu && cd docker-qemu/6.1
    # docker build -t gnh1201/qemu:6.1 .

    or use Docker Hub

    # docker pull gnh1201/qemu:6.1
  3. Write the bash file (e.g. win10-virtio.sh)

    #!/bin/bash
    docker run -it --rm \
        --device /dev/kvm \
        --name win10-virtio \
        --user="$(id --user):$(id --group)" \
        -v /home/john/win10-virtio.qcow2:/tmp/hda.qcow2 \
        -e QEMU_HDA=/tmp/hda.qcow2 \
        -e QEMU_HDA_SIZE=50G \
        -e QEMU_CPU=3 \
        -e QEMU_RAM=3072 \
        -v /cdimages/win10_x64_virtio.iso:/tmp/debian.iso:ro \
        -e QEMU_CDROM=/tmp/debian.iso \
        -e QEMU_BOOT='order=d' \
        -e QEMU_PORTS='2375 2376 3389' \
        -e QEMU_ARCH='x86_64' \
        gnh1201/qemu:6.1

    The example(/home/john/win10-virtio.qcow2 and /cdimages/win10_x64_virtio.iso) have to replace with your own path.

    If you want to allow RDP external access, please add EXPOSE 3389 to the file 6.1/Dockerfile (Must be rebuilt image)

  4. Run a container

    # touch /home/john/win10-virtio.qcow2
    # ./win10-virtio.sh
  5. Find an IP address of the container

    # docker ps    # get the container ID
    # docker inspect <container ID>   # get an IP address
  6. Connect to the container via VNC

    Access the container with a client capable of accessing the VNC protocol.

All done.

If you have any questions, contact me.

Clone this wiki locally