dockur / windows

Windows inside a Docker container.
MIT License
17.66k stars 1.53k forks source link

Passthrough USB HDD #36

Closed Antroxin closed 8 months ago

Antroxin commented 8 months ago

Hi, I would like to know if it is possible to passthrough a physical USB external HDD connected to the Host to the docker via volumes

kroese commented 8 months ago

You can add this to your compose file:

environment:
  DEVICE2: "/dev/sdb"
devices:
  - /dev/sdb

and it should work. But only do it when you have a backup of your USB drive. Because if something goes wrong and Windows format the device for example, its better to be safe.

Antroxin commented 8 months ago

Thanks Kroese for your help.

Whenever I add the device to the docker-compose config file, docker does not work. The log says: ❯ Starting Windows for Docker v1.03... ❯ For support visit https://github.com/dockur/windows ❯ ERROR: KVM acceleration not detected (device file missing), this will cause a major loss of performance. ❯ ERROR: See the FAQ on how to enable it, or continue without KVM by setting KVM=N (not recommended).

This is my configuration: ` windows: image: dockurr/windows container_name: windows devices:

Wiggen94 commented 8 months ago

This is my configuration: windows: image: dockurr/windows container_name: windows devices: - /dev/kvm cap_add: - NET_ADMIN networks: - proxy ports: - 8006:8006 stop_grace_period: 2m restart: unless-stopped volumes: - /opt/containers/windows:/storage devices: - /dev/sdb environment: RAM_SIZE: "8G" DEVICE2: "/dev/sdb"

Looks like you removed

    devices:
      - /dev/kvm

That should be there as well.

Antroxin commented 8 months ago

Yes, it was devined devices twice, grouping then in only one, now it is working and HDD is detected and accessed in Windows. Thanks!