feat: Make qcow2 the default
* feat: Make qcow2 the default
This commit is contained in:
parent
abedbac751
commit
d9908b034d
3 changed files with 22 additions and 17 deletions
|
@ -8,7 +8,6 @@ services:
|
||||||
RAM_SIZE: "1G"
|
RAM_SIZE: "1G"
|
||||||
CPU_CORES: "1"
|
CPU_CORES: "1"
|
||||||
DISK_SIZE: "16G"
|
DISK_SIZE: "16G"
|
||||||
DISK_FMT: "qcow2"
|
|
||||||
BOOT: "https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-standard-3.18.2-x86_64.iso"
|
BOOT: "https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-standard-3.18.2-x86_64.iso"
|
||||||
devices:
|
devices:
|
||||||
- /dev/kvm
|
- /dev/kvm
|
||||||
|
|
28
readme.md
28
readme.md
|
@ -32,8 +32,6 @@ services:
|
||||||
image: qemux/qemu-docker:latest
|
image: qemux/qemu-docker:latest
|
||||||
environment:
|
environment:
|
||||||
DISPLAY: "vnc"
|
DISPLAY: "vnc"
|
||||||
DISK_SIZE: "16G"
|
|
||||||
DISK_FMT: "qcow2"
|
|
||||||
BOOT: "https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-standard-3.18.2-x86_64.iso"
|
BOOT: "https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-standard-3.18.2-x86_64.iso"
|
||||||
devices:
|
devices:
|
||||||
- /dev/kvm
|
- /dev/kvm
|
||||||
|
@ -48,7 +46,7 @@ services:
|
||||||
Via `docker run`
|
Via `docker run`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -it --rm -e "BOOT=http://www.example.com/image.iso" --device=/dev/kvm --cap-add NET_ADMIN qemux/qemu-docker:latest
|
docker run -it --rm -e "BOOT=http://www.example.com/image.iso" -p 5900:5900 --device=/dev/kvm --cap-add NET_ADMIN qemux/qemu-docker:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
@ -66,7 +64,7 @@ docker run -it --rm -e "BOOT=http://www.example.com/image.iso" --device=/dev/kvm
|
||||||
|
|
||||||
* ### How do I change the size of the data disk?
|
* ### How do I change the size of the data disk?
|
||||||
|
|
||||||
To expand the default size of 16 GB, locate the `DISK_SIZE` setting in your compose file and modify it to your preferred capacity:
|
To expand the default size of 16 GB, add the `DISK_SIZE` setting to your compose file and set it to your preferred capacity:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
environment:
|
environment:
|
||||||
|
@ -86,17 +84,6 @@ docker run -it --rm -e "BOOT=http://www.example.com/image.iso" --device=/dev/kvm
|
||||||
|
|
||||||
Replace the example path `/home/user/data` with the desired storage folder.
|
Replace the example path `/home/user/data` with the desired storage folder.
|
||||||
|
|
||||||
* ### How do I create a growable disk?
|
|
||||||
|
|
||||||
By default, the entire capacity of the disk is reserved in advance. To create a growable disk that only allocates space that is actually used, add the following environment variable:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
environment:
|
|
||||||
DISK_FMT: "qcow2"
|
|
||||||
```
|
|
||||||
|
|
||||||
This can also be used to convert any existing disks to the ```qcow2``` format.
|
|
||||||
|
|
||||||
* ### How do I increase the amount of CPU or RAM?
|
* ### How do I increase the amount of CPU or RAM?
|
||||||
|
|
||||||
By default, a single core and 1 GB of RAM are allocated to the container. To increase this, add the following environment variables:
|
By default, a single core and 1 GB of RAM are allocated to the container. To increase this, add the following environment variables:
|
||||||
|
@ -184,6 +171,17 @@ docker run -it --rm -e "BOOT=http://www.example.com/image.iso" --device=/dev/kvm
|
||||||
|
|
||||||
Afterwards you can connect with any VNC client to port 5900.
|
Afterwards you can connect with any VNC client to port 5900.
|
||||||
|
|
||||||
|
* ### How do I passthrough the GPU?
|
||||||
|
|
||||||
|
To passthrough your Intel GPU, add the following lines to your compose file:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
environment:
|
||||||
|
GPU: "Y"
|
||||||
|
devices:
|
||||||
|
- /dev/dri
|
||||||
|
```
|
||||||
|
|
||||||
* ### How do I provide custom arguments to QEMU?
|
* ### How do I provide custom arguments to QEMU?
|
||||||
|
|
||||||
You can create the `ARGUMENTS` environment variable to provide additional arguments to QEMU at runtime:
|
You can create the `ARGUMENTS` environment variable to provide additional arguments to QEMU at runtime:
|
||||||
|
|
10
src/disk.sh
10
src/disk.sh
|
@ -4,7 +4,7 @@ set -Eeuo pipefail
|
||||||
# Docker environment variables
|
# Docker environment variables
|
||||||
|
|
||||||
: ${DISK_IO:='native'} # I/O Mode, can be set to 'native', 'threads' or 'io_turing'
|
: ${DISK_IO:='native'} # I/O Mode, can be set to 'native', 'threads' or 'io_turing'
|
||||||
: ${DISK_FMT:='raw'} # Disk file format, "raw" by default for backwards compatibility
|
: ${DISK_FMT:=''} # Disk file format, can be set to "raw" or "qcow2" (default)
|
||||||
: ${DISK_CACHE:='none'} # Caching mode, can be set to 'writeback' for better performance
|
: ${DISK_CACHE:='none'} # Caching mode, can be set to 'writeback' for better performance
|
||||||
: ${DISK_DISCARD:='on'} # Controls whether unmap (TRIM) commands are passed to the host.
|
: ${DISK_DISCARD:='on'} # Controls whether unmap (TRIM) commands are passed to the host.
|
||||||
: ${DISK_ROTATION:='1'} # Rotation rate, set to 1 for SSD storage and increase for HDD
|
: ${DISK_ROTATION:='1'} # Rotation rate, set to 1 for SSD storage and increase for HDD
|
||||||
|
@ -261,6 +261,14 @@ addDisk () {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ -z "$DISK_FMT" ]; then
|
||||||
|
if [ -f "$STORAGE/data.img" ]; then
|
||||||
|
DISK_FMT="raw"
|
||||||
|
else
|
||||||
|
DISK_FMT="qcow2"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
DISK_EXT="$(fmt2ext "$DISK_FMT")" || exit $?
|
DISK_EXT="$(fmt2ext "$DISK_FMT")" || exit $?
|
||||||
|
|
||||||
DISK1_FILE="$STORAGE/data"
|
DISK1_FILE="$STORAGE/data"
|
||||||
|
|
Loading…
Reference in a new issue