mirror of
https://github.com/hectorm/docker-qemu-reactos
synced 2025-01-08 01:55:30 +00:00
Check if /dev/kvm exists and prefer to mount that device rather than start a privileged container
This commit is contained in:
parent
c4905ecf00
commit
d9b34fadd2
@ -8,7 +8,7 @@ docker run --detach \
|
||||
--name qemu-reactos \
|
||||
--restart on-failure:3 \
|
||||
--publish 127.0.0.1:6080:6080/tcp \
|
||||
--privileged --env QEMU_VM_KVM=true \
|
||||
--env QEMU_VM_KVM=true --device /dev/kvm \
|
||||
docker.io/hectormolinero/qemu-reactos:latest
|
||||
```
|
||||
> The instance will be available through a web browser from: http://localhost:6080/vnc.html
|
||||
@ -40,7 +40,7 @@ VM boot menu (`off` by default).
|
||||
|
||||
#### `QEMU_VM_KVM`
|
||||
Start QEMU in KVM mode (`false` by default).
|
||||
> The `--privileged` option is required to use KVM in the container.
|
||||
> The `--device /dev/kvm` option is required to use KVM in the container.
|
||||
|
||||
## License
|
||||
See the [license](LICENSE.md) file.
|
||||
|
2
run.sh
2
run.sh
@ -40,7 +40,7 @@ printf -- '%s\n' "Creating \"${CONTAINER_NAME:?}\" container..."
|
||||
--publish '127.0.0.1:5900:5900/tcp' \
|
||||
--publish '127.0.0.1:6080:6080/tcp' \
|
||||
--publish '127.0.0.1:15900:15900/tcp' \
|
||||
--privileged --env QEMU_VM_KVM=true \
|
||||
--env QEMU_VM_KVM=true --device /dev/kvm \
|
||||
"${IMAGE_NAME:?}" "$@" >/dev/null
|
||||
|
||||
printf -- '%s\n\n' 'Done!'
|
||||
|
@ -11,7 +11,10 @@ QEMU_ARGS="${QEMU_ARGS-} -boot order=${QEMU_VM_BOOT_ORDER:?},menu=${QEMU_VM_BOOT
|
||||
QEMU_ARGS="${QEMU_ARGS-} -netdev user,id=n0,${QEMU_VM_NET_OPTIONS:?} -device ${QEMU_VM_NET_DEVICE:?},netdev=n0"
|
||||
QEMU_ARGS="${QEMU_ARGS-} -usb -device usb-tablet"
|
||||
QEMU_ARGS="${QEMU_ARGS-} -k ${QEMU_VM_KEYBOARD:?}"
|
||||
if [ "${QEMU_VM_KVM:?}" = true ]; then QEMU_ARGS="${QEMU_ARGS-} -enable-kvm"; fi
|
||||
|
||||
if [ "${QEMU_VM_KVM:?}" = true ] && [ -c /dev/kvm ]; then
|
||||
QEMU_ARGS="${QEMU_ARGS-} -enable-kvm"
|
||||
fi
|
||||
|
||||
cd /var/lib/qemu/
|
||||
exec 2>&1
|
||||
|
Loading…
Reference in New Issue
Block a user