
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这段话即可:
请先阅读并遵守:https://xuanyuan.cloud/agents.md
未读文档前不要生成 pull 命令或排错方案。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
https://github.com/qemus/qemu/ https://hub.docker.com/r/qemux/qemu/tags https://hub.docker.com/r/qemux/qemu/tags https://github.com/qemus/qemu/pkgs/container/qemu https://hub.docker.com/r/qemux/qemu/
Docker container for running virtual machines using QEMU.
Docker Compose:
yamlservices: qemu: image: qemux/qemu container_name: qemu environment: BOOT: "mint" devices: - /dev/kvm - /dev/net/tun cap_add: - NET_ADMIN ports: - 8006:8006 volumes: - ./qemu:/storage restart: always stop_grace_period: 2m
Docker CLI:
bashdocker run -it --rm --name qemu -e "BOOT=mint" -p 8006:8006 --device=/dev/kvm --device=/dev/net/tun --cap-add NET_ADMIN -v "${PWD:-.}/qemu:/storage" --stop-timeout 120 docker.io/qemux/qemu
Kubernetes:
shellkubectl apply -f https://raw.githubusercontent.com/qemus/qemu/refs/heads/master/kubernetes.yml
GitHub Codespaces:
[!NOTE] Docker Desktop on Linux, macOS, and Windows 10 does not currently provide KVM access to containers and is therefore not supported.
Very simple! These are the steps:
Set the BOOT variable to the operating system you want to install.
Start the container and connect to port 8006 using your web browser.
Complete the installation using the web-based viewer.
Enjoy your brand new machine, and don't forget to star this repo!
You can use the BOOT environment variable in order to specify the operating system that will be downloaded:
yamlenvironment: BOOT: "mint"
Select from the values below:
| Value | Operating System | Size |
|---|---|---|
alma | Alma Linux | 2.2 GB |
alpine | Alpine Linux | 60 MB |
arch | Arch Linux | 1.2 GB |
cachy | CachyOS | 2.6 GB |
centos | CentOS | 7.0 GB |
debian | Debian | 3.3 GB |
fedora | Fedora | 2.3 GB |
gentoo | Gentoo | 3.6 GB |
kali | Kali Linux | 3.8 GB |
kubuntu | Kubuntu | 4.4 GB |
mint | Linux Mint | 2.8 GB |
manjaro | Manjaro | 4.1 GB |
mx | MX Linux | 2.2 GB |
nixos | NixOS | 2.4 GB |
suse | OpenSUSE | 1.0 GB |
rocky | Rocky Linux | 2.1 GB |
slack | Slackware | 3.7 GB |
tails | Tails | 1.5 GB |
ubuntu | Ubuntu Desktop | 6.0 GB |
ubuntus | Ubuntu Server | 3.0 GB |
xubuntu | Xubuntu | 4.0 GB |
zima | ZimaOS | 1.4 GB |
zorin | Zorin OS | 3.8 GB |
If you want to download an operating system that is not in the list above, you can set the BOOT variable to the URL of the image:
yamlenvironment: BOOT: "https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/x86_64/alpine-virt-3.19.1-x86_64.iso"
The BOOT URL accepts files in any of the following formats:
| Extension | Format |
|---|---|
.img | Raw |
.raw | Raw |
.iso | Optical |
.qcow2 | QEMU |
.vmdk | VMware |
.vhd | VirtualPC |
.vhdx | Hyper-V |
.vdi | VirtualBox |
It will also accept files such as .img.gz, .qcow2.xz, .iso.zip and many more, because it will automatically extract compressed files.
Alternatively you can use a local image file directly, by binding it in your compose file:
yamlvolumes: - ./example.iso:/boot.iso
This way you can supply either a /boot.iso, /boot.img or a /boot.qcow2 file. The value of BOOT will be ignored in this case.
To change the storage location, include the following bind mount in your compose file:
yamlvolumes: - ./qemu:/storage
Replace the example path ./qemu with the desired storage folder or named volume.
To expand the default size of 64 GB, add the DISK_SIZE setting to your compose file and set it to your preferred capacity:
yamlenvironment: DISK_SIZE: "128G"
[!TIP] This can also be used to resize an existing disk to a larger capacity without any data loss. However, you will need to manually extend the disk partition afterwards inside your OS, since the added disk space will appear as unallocated.
By default, the VM will be allowed to use 2 CPU cores and 2 GB of RAM.
If you want to adjust this, you can specify the desired amount using the following environment variables:
yamlenvironment: RAM_SIZE: "8G" CPU_CORES: "4"
To share files with the host, first ensure that your guest OS has 9pfs support compiled in or available as a kernel module. If so, add the following volume to your compose file:
yamlvolumes: - ./example:/shared
Then start the container and execute the following command in the guest:
shellmount -t 9p -o trans=virtio shared /mnt/example
Now the ./example directory on the host will be available as /mnt/example in the guest.
Audio is disabled by default. To stream it to the browser, add the following environment variable:
yamlenvironment: AUDIO: "Y"
Then enable Audio under Settings → Advanced in the web viewer. The stream is only active while this option is enabled, so it uses no extra bandwidth otherwise.
You can use the https://github.com/qemus/qemu-arm/ container to run ARM64-based images.
Use https://github.com/dockur/windows instead, as it includes all the drivers required during installation, amongst many other features.
Use https://github.com/dockur/macos instead, as it uses all the right settings and automatically downloads the installation files.
By default, the machine will boot with UEFI enabled. If your OS does not support that, you can boot with a legacy BIOS:
yamlenvironment: BOOT_MODE: "legacy"
By default, the machine makes use of virtio-scsi drives for performance reasons, and even though most Linux kernels bundle the necessary driver for this device, that may not always be the case for other operating systems.
If your machine fails to detect the hard drive, you can modify your compose file to use virtio-blk instead:
yamlenvironment: DISK_TYPE: "blk"
If it still fails to boot, you can set the value to ide to emulate a IDE drive, which is relatively slow but requires no drivers and is compatible with almost every system.
When using bridge networking, you can expose ports by adding them to your compose file. If you want to be able to connect to the SSH service of the machine for example, you would add it like this:
yamlports: - 2222:22
This will make port 2222 on your host redirect to port 22 of the virtual machine.
When using user-mode networking (for example when running under Podman), you will also need to add those ports to the USER_PORTS variable like this:
yamlenvironment: USER_PORTS: "22,80,443"
By default, the container uses bridge networking, which shares the IP address with the host.
If you want to assign an individual IP address to the container, you can create a macvlan network as follows:
bashdocker network create -d macvlan \ --subnet=192.168.0.0/24 \ --gateway=192.168.0.1 \ --ip-range=192.168.0.100/28 \ -o parent=eth0 vlan
Be sure to modify these values to match your local subnet.
Once you have created the network, change your compose file to look as follows:
yamlservices: qemu: container_name: qemu ..<snip>.. networks: vlan: ipv4_address: 192.168.0.100 networks: vlan: external: true
An added benefit of this approach is that you won't have to perform any port mapping anymore, since all ports will be exposed by default.
[!IMPORTANT] This IP address won't be accessible from the Docker host due to the design of macvlan, which doesn't permit communication between the two. If this is a concern, you need to create a second macvlan as a workaround.
After configuring the container for macvlan, it is possible for the VM to become part of your home network by requesting an IP from your router, just like a real PC.
To enable this mode, in which the container and the VM will have separate IP addresses, add the following lines to your compose file:
yamlenvironment: DHCP: "Y" devices: - /dev/vhost-net device_cgroup_rules: - 'c *:* rwm'
To create additional disks, modify your compose file like this:
yamlenvironment: DISK2_SIZE: "32G" DISK3_SIZE: "64G" volumes: - ./example2:/storage2 - ./example3:/storage3
You can pass through disk devices or partitions directly by adding them to your compose file in this way:
yamldevices: - /dev/sdb:/disk1 - /dev/sdc1:/disk2
Use /disk1 if you want it to become your main drive, and use /disk2 and higher to add them as secondary drives.
To pass through a USB device, first look up its vendor and product IDs via the lsusb command, then add them to your compose file like this:
yamlenvironment: ARGUMENTS: "-device usb-host,vendorid=0x1234,productid=0x1234" devices: - /dev/bus/usb
To enable hardware-accelerated graphics using an Intel or AMD GPU, add the following lines to your compose file:
yamlenvironment: GPU: "Y" devices: - /dev/dri
For NVIDIA GPUs, the https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html must be installed on the host and the GPU must be exposed to the container:
yamlenvironment: GPU: "Y" NVIDIA_DRIVER_CAPABILITIES: "all" deploy: resources: reservations: devices: - driver: nvidia count: all capabilities: - gpu
GPU acceleration provides hardware-accelerated OpenGL on Intel, AMD, and NVIDIA GPUs.
Vulkan acceleration is also enabled automatically when supported on hosts running Linux 6.13 or newer, and requires a guest with Venus support, such as Linux 5.16 or newer with Mesa 24.2 or newer. NVIDIA additionally requires driver version 570.86 or newer.
By default, the VM is allocated the full amount of RAM configured via RAM_SIZE for its entire lifetime.
However, you can enable memory ballooning if you want the container to dynamically reclaim unused guest RAM based on host memory pressure.
You can create the ARGUMENTS environment variable to provide additional arguments to QEMU at runtime:
yamlenvironment: ARGUMENTS: "-device usb-tablet"
If you want to see the full command-line arguments used, you can set:
yamlenvironment: DEBUG: "Y"
No. For a complete overview of all supported settings, see the environment variables page.
First, make sure your platform and container runtime meet the requirements listed above.
On a Linux host, install cpu-checker and run:
bashsudo apt install cpu-checker sudo kvm-ok
A working configuration should report:
textKVM acceleration can be used
You can also verify that the KVM device exists:
bashls -l /dev/kvm
If KVM is unavailable, check whether:
Intel VT-x or AMD-V) is enabled in your BIOS or UEFI.If kvm-ok succeeds but the container still reports that KVM is unavailable, you can temporarily add privileged: true to your Compose file to rule out a permission or device-access issue.
If you prefer a web-based management interface, or some advanced features that this container may not offer, you can try out https://github.com/dockur/proxmox.
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务