From f9f8ee4d428f01a4f62a68a5b0b9937512c016b6 Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Mon, 19 May 2025 07:36:11 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Ddocker=E5=88=86?= =?UTF-8?q?=E5=8C=BA=E6=9B=B4=E5=8A=A0=E6=98=8E=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +- docs/.vitepress/config.mts | 11 +- docs/en/guide/docker/docker_android.md | 57 ++++++++ docs/en/guide/docker/docker_custom.md | 144 ------------------ docs/en/guide/docker/docker_macos.md | 21 +++ docs/en/guide/docker/docker_windows.md | 194 +++++++++++++++++++++++++ 6 files changed, 282 insertions(+), 149 deletions(-) create mode 100644 docs/en/guide/docker/docker_android.md create mode 100644 docs/en/guide/docker/docker_macos.md create mode 100644 docs/en/guide/docker/docker_windows.md diff --git a/README.md b/README.md index d5792940bd..1baf04ea0f 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,9 @@ Documentation for one-click virtualization -一键安装与使用 Proxmox-VE、incus、LXD、Docker 的说明文档,同时包含其他项目指南: +一键安装与使用 Proxmox-VE、incus、LXD、Docker 的说明文档,同时包含其他项目指南 + +Documentation for one-click installation and use of Proxmox-VE, incus, LXD, Docker, and other project guides ``` webvirtcloud diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 22395ed140..47eb209d0c 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -262,9 +262,9 @@ function getGuideSidebarEnUS() { { text: 'PVE main installation', link: '/en/guide/pve/pve_install.html' }, { text: 'Linux Virtual Machine(KVM/QEMU)', link: '/en/guide/pve/pve_kvm.html' }, { text: 'Linux Container(LXC)', link: '/en/guide/pve/pve_lxc.html' }, - { text: 'Windows Virtual Machine', link: '/en/guide/pve/pve_windows.html' }, - { text: 'MacOS Virtual Machine', link: '/en/guide/pve/pve_macos.html' }, - { text: 'Android Virtual Machine', link: '/en/guide/pve/pve_android.html' }, + { text: 'Windows Virtual Machine(KVM/QEMU)', link: '/en/guide/pve/pve_windows.html' }, + { text: 'MacOS Virtual Machine(KVM)', link: '/en/guide/pve/pve_macos.html' }, + { text: 'Android Virtual Machine(KVM)', link: '/en/guide/pve/pve_android.html' }, { text: 'Custom', link: '/en/guide/pve/pve_custom.html' }, { text: 'Acknowledgements', link: '/en/guide/pve/pve_thanks.html' }, { text: 'FAQ', link: '/en/guide/pve/pve_qa.html' } @@ -287,7 +287,10 @@ function getGuideSidebarEnUS() { items: [ { text: 'Configuration requirements', link: '/en/guide/docker/docker_precheck.html' }, { text: 'Docker main installation', link: '/en/guide/docker/docker_install.html' }, - { text: 'Docker Virtualization', link: '/en/guide/docker/docker_build.html' }, + { text: 'Linux Container(LXC)', link: '/en/guide/docker/docker_build.html' }, + { text: 'Windows Virtual Machine(KVM/QEMU)', link: '/en/guide/docker/docker_windows.html' }, + { text: 'Macos Virtual Machine(KVM)', link: '/en/guide/docker/docker_macos.html' }, + { text: 'Android Virtual Machine(KVM/QEMU)', link: '/en/guide/docker/docker_android.html' }, { text: 'Custom', link: '/en/guide/docker/docker_custom.html' }, { text: 'Acknowledgements', link: '/en/guide/docker/docker_thanks.html' }, { text: 'FAQ', link: '/en/guide/docker/docker_qa.html' } diff --git a/docs/en/guide/docker/docker_android.md b/docs/en/guide/docker/docker_android.md new file mode 100644 index 0000000000..88fe82c99c --- /dev/null +++ b/docs/en/guide/docker/docker_android.md @@ -0,0 +1,57 @@ +--- +outline: deep +--- + +# Running Android Virtual Machine in Docker + +## One-Click Deployment + +- Customizable Android version +- Automatically creates a validated web website +- Automatically installs Nginx and configures reverse proxy. Option to bind a domain is available. Default is port 80 if no domain binding is chosen. +- No need to worry about host machine supporting nested virtualization +- Supports x86_64 and ARM architectures + +**Host machine should have a minimum configuration of 1 core, 2GB RAM, and 15GB storage, else starting the setup might lead to host machine freezing.** + +Ubuntu is recommended for hosting, Debian may cause white screen on Android. + +Newer Android versions occupy more resources. The above configuration requirements are for the minimum version of Android. (Personally tested with the tag "12.0.0-latest", higher versions resulted in a blank screen. Test which version works for you.) + +If, after 5 minutes after opening, the login verification of the browser page still keeps failing, then please check the logs of the Android container, it is probable that the Android container has crashed, and it is recommended to replace the container with a lower version of the Android system for installation. + +**Setup:** + +Command: + +```shell +curl -L https://raw.githubusercontent.com/oneclickvirt/docker/main/scripts/create_android.sh -o create_android.sh && chmod +x create_android.sh && bash create_android.sh +``` + +After executing the command, follow the prompts to input the required information. Make sure to choose the version by entering the corresponding number index. Once the installation is complete, open ```YourMachineIPv4+80Port``` to log in. + +If you need to check the generated Android information and web login details, execute ```cat /root/android_info``` to retrieve the information. + +Default username: ```onea``` +Default password: ```oneclick``` + +For remote desktop, click on ```H264 Converter``` to initiate the redirection. + +**Please note that currently only one Android container can be generated. Do not generate duplicates. If you need to replace the version, please execute the subsequent commands after deletion.** + +**Temporarily only support the opening has been used, can not restart the server, reboot may not be able to restart after the mapping success, self-test** + +**Deletion:** + +- Delete the container +- Delete the corresponding container image +- Delete the configuration file + +```shell +docker rm -f android +docker rmi $(docker images | grep "redroid" | awk '{print $3}') +rm -rf /etc/nginx/sites-enabled/reverse-proxy +rm -rf /etc/nginx/sites-available/reverse-proxy +rm -rf /etc/nginx/passwd_scrcpy_web +rm -rf /root/android_info +``` \ No newline at end of file diff --git a/docs/en/guide/docker/docker_custom.md b/docs/en/guide/docker/docker_custom.md index 8d8f8ce8e0..1f6b2d0a8b 100644 --- a/docs/en/guide/docker/docker_custom.md +++ b/docs/en/guide/docker/docker_custom.md @@ -10,150 +10,6 @@ If the configured memory is not enough, then it's okay to make up for it with th Note that the following scripts must be pre-installed using the environment installation scripts in this set of tutorials before using them -## One-Click Setup of Android System Container - -- Customizable Android version -- Automatically creates a validated web website -- Automatically installs Nginx and configures reverse proxy. Option to bind a domain is available. Default is port 80 if no domain binding is chosen. -- No need to worry about host machine supporting nested virtualization -- Supports x86_64 and ARM architectures - -**Host machine should have a minimum configuration of 1 core, 2GB RAM, and 15GB storage, else starting the setup might lead to host machine freezing.** - -Ubuntu is recommended for hosting, Debian may cause white screen on Android. - -Newer Android versions occupy more resources. The above configuration requirements are for the minimum version of Android. (Personally tested with the tag "12.0.0-latest", higher versions resulted in a blank screen. Test which version works for you.) - -If, after 5 minutes after opening, the login verification of the browser page still keeps failing, then please check the logs of the Android container, it is probable that the Android container has crashed, and it is recommended to replace the container with a lower version of the Android system for installation. - -**Setup:** - -Command: - -```shell -curl -L https://raw.githubusercontent.com/oneclickvirt/docker/main/scripts/create_android.sh -o create_android.sh && chmod +x create_android.sh && bash create_android.sh -``` - -After executing the command, follow the prompts to input the required information. Make sure to choose the version by entering the corresponding number index. Once the installation is complete, open ```YourMachineIPv4+80Port``` to log in. - -If you need to check the generated Android information and web login details, execute ```cat /root/android_info``` to retrieve the information. - -Default username: ```onea``` -Default password: ```oneclick``` - -For remote desktop, click on ```H264 Converter``` to initiate the redirection. - -**Please note that currently only one Android container can be generated. Do not generate duplicates. If you need to replace the version, please execute the subsequent commands after deletion.** - -**Temporarily only support the opening has been used, can not restart the server, reboot may not be able to restart after the mapping success, self-test** - -**Deletion:** - -- Delete the container -- Delete the corresponding container image -- Delete the configuration file - -```shell -docker rm -f android -docker rmi $(docker images | grep "redroid" | awk '{print $3}') -rm -rf /etc/nginx/sites-enabled/reverse-proxy -rm -rf /etc/nginx/sites-available/reverse-proxy -rm -rf /etc/nginx/passwd_scrcpy_web -rm -rf /root/android_info -``` - -## One-Click Setup of Windows System Container - -- Shares all resources of the host machine; based on Docker, so it only occupies the size of the system, suitable for multiple instances. -- Shares IP; Docker's NAT mapping is employed. You can choose whether to map to the external network or just the internal network. -- The configured Windows system is set to use a maximum of 1 core, 2GB RAM, and 50GB hard disk by default. Actual usage may vary based on usage patterns. -- No need for iptables for NAT mapping; port mappings are automatically deleted when containers are removed, making maintenance easier. -- Ensure that the host machine supports nested virtualization, and currently, only X86_64 architecture systems are supported. I haven't compiled corresponding images for ARM devices at the moment. - -**The host machine needs to support nested virtualization and currently only supports systems based on the X86_64 architecture; I don't have an ARM machine on hand to compile the corresponding image at the moment.** - -Command: - -```shell -egrep -c '(vmx|svm)' /proc/cpuinfo -``` - -The result should be greater than or equal to 1 and cannot be 0. - -Next, you need to configure Docker to start using the v1 version of cgroup. - -```shell -sed -i 's/GRUB_CMDLINE_LINUX="\(.*\)"/GRUB_CMDLINE_LINUX="\1 systemd.unified_cgroup_hierarchy=0"/' /etc/default/grub -update-grub -ls -``` - -If there are no errors during execution, run the ```reboot``` command to restart the system and apply the settings. - -**Supported Images** - -We are using custom-built images: [https://hub.docker.com/r/spiritlhl/wds](https://hub.docker.com/r/spiritlhl/wds) - -| Image Name | Image Size | -|------------|------------| -| 10 | 20GB | -| 2022 | 17.5GB | -| 2019 | 17GB | - -The size of the created container will be slightly larger than the image size, but not by much. - -**Download Script** - -``` -curl -L https://raw.githubusercontent.com/oneclickvirt/docker/main/scripts/onewindows.sh -o onewindows.sh && chmod +x onewindows.sh -``` - -**Usage Instructions** - -Make sure to execute the following commands in a 'screen' session before proceeding, to avoid potential disconnection or freezing of the SSH connection. - -``` -./onewindows.sh -``` - -- Replace with the name. -- Replace with the desired Windows system version. -- Replace with the port number for RDP access. -- If you want to enable external mapping, replace with 'Y'. If not, leave it blank or use 'N'. - -Before initiating the setup, ensure that the host machine has a disk size at least twice the size of the image, plus an additional 10GB, as Docker needs to pull the image locally before creating the container. - -During the creation process, the peak disk usage will be ```host_system_size + image_size + container_size```. - -For example, to set up a container with the name ```test```, the container with the lowest occupancy ```Windows 2019``` system, map the extranet RDP port ```13389``` and set it to ```extranet mapping``` (mapping to your server's extranet IPV4 address) - -```shell -./onewindows.sh test 2019 13389 Y -``` - -After it, the default usernames are ```Administrator``` and ```vagrant```, with the default password being ```vagrant```. - -If you choose to open a mapped extranet port, be sure to log in and change the password of the corresponding account (both accounts may have, try it yourself), otherwise it may be abused by someone blasting - -**Deletion** - -To delete the corresponding image and container, first use the command ```docker ps -a``` and ```docker images``` to find the ID of the image named ```spiritlhl/wds```. Then, use the following commands accordingly: - -``` -docker rm -f container_ID -docker rmi image_ID -``` - -After deletion, you can create containers of different versions of Windows. - -**Other similar projects** - -https://github.com/dockur/windows - Similar project that support more systems, but have more resource requirements - -https://github.com/dockur/windows-arm/ - It's great that he has ARM servers for mirror compilation, my project doesn't have - -Note that both of the above projects require a host with at least 4 cores of CPU, at least 4G of RAM, and at least 64G of hard disk, which is greater than the mirroring requirements of my project. (The advantage of his project is that you can customize many configuration items, see his corresponding project description for details.) - ## One-Click Setup of Firefox Browser Container - Crash recovery on startup has been configured. diff --git a/docs/en/guide/docker/docker_macos.md b/docs/en/guide/docker/docker_macos.md new file mode 100644 index 0000000000..c315cdf8d1 --- /dev/null +++ b/docs/en/guide/docker/docker_macos.md @@ -0,0 +1,21 @@ +--- +outline: deep +--- + +# Running macOS Virtual Machines in Docker + +## Using Dockur + +Original Project: + +[https://github.com/dockur/macos](https://github.com/dockur/macos) + +## Using Docker-OSX + +Original Project: + +[https://github.com/sickcodes/Docker-OSX](https://github.com/sickcodes/Docker-OSX) + +--- + +Let me know if you'd like me to expand or rephrase any part. diff --git a/docs/en/guide/docker/docker_windows.md b/docs/en/guide/docker/docker_windows.md new file mode 100644 index 0000000000..c4ff72ecf0 --- /dev/null +++ b/docs/en/guide/docker/docker_windows.md @@ -0,0 +1,194 @@ +--- +outline: deep +--- + +# Running Windows Virtual Machine in Docker + +## One-Click Deployment (Using Vagrant) + +- Shares all resources of the host machine; based on Docker, so it only occupies the size of the system, suitable for multiple instances. +- Shares IP; Docker's NAT mapping is employed. You can choose whether to map to the external network or just the internal network. +- The configured Windows system is set to use a maximum of 1 core, 2GB RAM, and 50GB hard disk by default. Actual usage may vary based on usage patterns. +- No need for iptables for NAT mapping; port mappings are automatically deleted when containers are removed, making maintenance easier. +- Ensure that the host machine supports nested virtualization, and currently, only X86_64 architecture systems are supported. I haven't compiled corresponding images for ARM devices at the moment. + +**The host machine needs to support nested virtualization and currently only supports systems based on the X86_64 architecture; I don't have an ARM machine on hand to compile the corresponding image at the moment.** + +Command: + +```shell +egrep -c '(vmx|svm)' /proc/cpuinfo +``` + +The result should be greater than or equal to 1 and cannot be 0. + +Next, you need to configure Docker to start using the v1 version of cgroup. + +```shell +sed -i 's/GRUB_CMDLINE_LINUX="\(.*\)"/GRUB_CMDLINE_LINUX="\1 systemd.unified_cgroup_hierarchy=0"/' /etc/default/grub +update-grub +ls +``` + +If there are no errors during execution, run the ```reboot``` command to restart the system and apply the settings. + +**Supported Images** + +We are using custom-built images: [https://hub.docker.com/r/spiritlhl/wds](https://hub.docker.com/r/spiritlhl/wds) + +| Image Name | Image Size | +|------------|------------| +| 10 | 20GB | +| 2022 | 17.5GB | +| 2019 | 17GB | + +The size of the created container will be slightly larger than the image size, but not by much. + +**Download Script** + +``` +curl -L https://raw.githubusercontent.com/oneclickvirt/docker/main/scripts/onewindows.sh -o onewindows.sh && chmod +x onewindows.sh +``` + +**Usage Instructions** + +Make sure to execute the following commands in a 'screen' session before proceeding, to avoid potential disconnection or freezing of the SSH connection. + +``` +./onewindows.sh +``` + +- Replace with the name. +- Replace with the desired Windows system version. +- Replace with the port number for RDP access. +- If you want to enable external mapping, replace with 'Y'. If not, leave it blank or use 'N'. + +Before initiating the setup, ensure that the host machine has a disk size at least twice the size of the image, plus an additional 10GB, as Docker needs to pull the image locally before creating the container. + +During the creation process, the peak disk usage will be ```host_system_size + image_size + container_size```. + +For example, to set up a container with the name ```test```, the container with the lowest occupancy ```Windows 2019``` system, map the extranet RDP port ```13389``` and set it to ```extranet mapping``` (mapping to your server's extranet IPV4 address) + +```shell +./onewindows.sh test 2019 13389 Y +``` + +After it, the default usernames are ```Administrator``` and ```vagrant```, with the default password being ```vagrant```. + +If you choose to open a mapped extranet port, be sure to log in and change the password of the corresponding account (both accounts may have, try it yourself), otherwise it may be abused by someone blasting + +**Deletion** + +To delete the corresponding image and container, first use the command ```docker ps -a``` and ```docker images``` to find the ID of the image named ```spiritlhl/wds```. Then, use the following commands accordingly: + +``` +docker rm -f container_ID +docker rmi image_ID +``` + +After deletion, you can create containers of different versions of Windows. + +**Other similar projects** + +https://github.com/dockur/windows - Similar project that support more systems, but have more resource requirements + +https://github.com/dockur/windows-arm/ - It's great that he has ARM servers for mirror compilation, my project doesn't have + +Note that both of the above projects require a host with at least 4 cores of CPU, at least 4G of RAM, and at least 64G of hard disk, which is greater than the mirroring requirements of my project. (The advantage of his project is that you can customize many configuration items, see his corresponding project description for details.) + +## Manual Provisioning (via the Dockur Project) + +This project supports VM creation using QEMU even on host systems that do not support nested virtualization. + +### Original Project Repositories + +* [https://github.com/dockur/windows](https://github.com/dockur/windows) +* [https://github.com/dockur/windows-arm](https://github.com/dockur/windows-arm) + +⚠️ Notes: + +* The original project provides only the launcher, not a Windows image. +* The first container startup may take up to 4 hours on domestic (China) networks, due to image download and installation. +* The host system should meet the following minimum hardware requirements (can be adjusted via script modifications): + + * CPU: At least 4 cores + * RAM: At least 4 GB + * Disk: At least 64 GB + +For customization such as reducing resource usage or changing launch parameters, refer to: + +* [https://www.spiritysdx.top/20250405/](https://www.spiritysdx.top/20250405/) +* [https://www.spiritysdx.top/20250315/](https://www.spiritysdx.top/20250315/) + +### For x86\_64 Architecture Users + +A pre-modified single-file launcher is available to simplify building a Windows image. This version writes system files and images directly into Docker’s writable layer—no external image mounting required. + +Download link: +[https://github.com/oneclickvirt/docker/releases/download/amd64\_builder/builder.tar](https://github.com/oneclickvirt/docker/releases/download/amd64_builder/builder.tar) + +Import Docker image: + +```bash +docker load -i builder.tar +``` + +#### Launching the Container with a Custom Windows ISO + +Download a Windows ISO image from: +[https://down.idc.wiki/ISOS/Windows/](https://down.idc.wiki/ISOS/Windows/) + +Sample command to start the container: + +```bash +docker run -it -d \ + -e RAM_SIZE="8G" \ + -e CPU_CORES="4" \ + --name win2022 \ + -p 8006:8006 \ + --device=/dev/kvm \ + --device=/dev/net/tun \ + --cap-add NET_ADMIN \ + -v "$(pwd)/WindowsImage.iso:/boot.iso" \ + --stop-timeout 120 \ + windows:builder +``` + +### Using Pre-Built Image (Recommended for Quick Deployment) + +We also offer a ready-to-use image with the system and configuration already integrated. Features: + +* Image size: \~26 GB (includes system image and default config) +* Supports auto disk expansion and startup tasks +* Just download, import, and run +* ⚠️ Note: Combined download will require \~60 GB of free space + +#### Download and Merge Split Files + +```bash +curl https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/docker/refs/heads/main/extra_scripts/mergew.sh -o mergew.sh +chmod +x mergew.sh +bash mergew.sh +``` + +#### Start the Container + +```bash +docker load -i win2022.tar +docker run -it -d \ + -e RAM_SIZE="4G" \ + -e CPU_CORES="2" \ + --name win2022 \ + -p 8006:8006 \ + --device=/dev/kvm \ + --device=/dev/net/tun \ + --cap-add NET_ADMIN \ + --stop-timeout 120 \ + windows:2022 +``` + +### Important Notes + +It is not recommended to use docker commit to save changes to this image, as repeated layer stacking may cause the image size to exceed 40 GB. + +For personalized configuration or additional software integration, always start from the builder image to ensure a clean and maintainable result. \ No newline at end of file