This project automates the installation and booting of Alpine Linux in a QEMU virtual machine, utilizing Docker inside the VM for containerized environments. The project runs seamlessly within Termux on Android. This guide will walk you through the process.
- Introduction
- Features
- Prerequisites
- Installation
- Usage
- Video Guide
- Asciinema Demo
- Contributing
- License
This project is designed for users who want to set up and run Alpine Linux on QEMU within Termux, and manage containers via Docker. It consists of two key scripts:
- install_alpine.sh: Installs the necessary components for running QEMU and Alpine Linux in Termux.
- start_alpine.sh: Boots the Alpine Linux VM with a shared folder and Docker capabilities.
- Full Alpine Linux VM inside Termux using QEMU.
- Docker installed and configured within the Alpine Linux environment.
- Shared folder between host (Android/Termux) and VM.
- Lightweight and efficient setup for development and testing.
Before you begin, ensure you have the following installed:
- Termux (Android), Termux-API (Android)
- QEMU (installed via Termux)
- Internet access for downloading required files
- Minimum 4GB RAM recommended for smooth operation
Clone this repository to your local machine:
git clone https://github.com/remo7777/alpine-vm.git && cd alpine-vm;
Run the install_alpine.sh
script to install Alpine Linux, Docker, and set up QEMU:
bash install_alpine.sh
After successfully booting it ask for Login: "root
"
then paste command wich set by install_alpine.sh
.
Some cases you copy something esle then copy command and paste on alpine vm prompt:
mkdir -p /mnt/vm-shared && mount -t 9p -o trans=virtio vm-shared /mnt/vm-shared && setup-alpine -f /mnt/vm-shared/answers.txt
After installation, you can start the Alpine Linux VM with Docker pre-configured using the following command:
bash start_alpine.sh
After successfully booting it ask for Login: "root
"
And it ask for root passowrd: "?
" which you have set during install_alpine.sh
then paste command wich set by start_alpine.sh
.
Some cases you copy something esle then copy command and paste on alpine vm prompt:
mkdir -p /mnt/vm-shared && mount -t 9p -o trans=virtio vm-shared /mnt/vm-shared && setup-alpine -f /mnt/vm-shared/answers.txt
The VM will start in headless mode, and you can SSH into it using the following command on termux environment:
ssh root@localhost -p 2222
The password is set during the installation.
if SSH will detect a mismatch between the new key and the existing key stored in ~/.ssh/known_hosts. This mismatch triggers a warning or an error.
The command ssh-keygen -R "[localhost]:2222"
is used to remove an existing SSH key entry for the specified hostname and port from the ~/.ssh/known_hosts
file.
A shared folder between Termux and the VM is located at ~/vm-shared
. You can access this within the VM as /vm-shared
.
To execute Docker commands inside termux terminal not in the VM, simply use command on termux terminal:
docker run hello-world
Watch the YouTube guide for a step-by-step walkthrough of the installation and usage:
Check out this Asciinema video to see the setup in action directly from the terminal.
Contributions are welcome! Feel free to open a pull request or issue on GitHub if you'd like to contribute to this project.
This project is licensed under the MIT License. See the LICENSE file for more details.