Skip to content

This is our way of getting a docker like env on mobile hope this helps for advanced devs only

Notifications You must be signed in to change notification settings

DresOperatingSystems/Docker-android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 

Repository files navigation

Rootless Python Environment for Bots on Android

This guide provides a method to create a Docker like, isolated environment on Android devices using Termux. It allows advanced developers to deploy Python bots or applications on rootless devices. This setup uses a chrooted Ubuntu environment within Termux for enhanced isolation and compatibility.

Warning: This is intended for advanced users only. Ensure you understand the steps, as improper execution may lead to issues with your Termux setup.

Prerequisites:

  • Termux installed (refer to our Kali NetHunter repository for setup instructions).
  • Android device with sufficient resources (at least 2 GB RAM recommended).
  • Basic knowledge of Linux commands and Python development.

Installing Ubuntu in Termux

Run the following commands in Termux one by one:

pkg install git -y
pkg install wget openssl-tool proot -y && hash -r && wget https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Scripts/Installer/Ubuntu/ubuntu.sh && bash ubuntu.sh

Start the Ubuntu environment:

./start-ubuntu.sh

Updating and Installing Dependencies

Update the system and install required packages:

apt update && apt full-upgrade -y
apt install python3 -y
apt install python3-doc python3-venv python3.13-doc binfmt-support python3-tk python3.13-venv binutils -y
apt install cpp-doc flex bzr gcc-14-locales bison gdbm-l10n ed cpp-14-doc gdb diffutils-doc debian-keyring gcc-doc ncurses-doc perl-doc gcc-14-doc readline-doc libterm-readline-gnu-perl libc-devtools sqlite3-doc libterm-readline-perl-perl autoconf glibc-doc libssl-doc libtap-harness-archive-perl automake sensible-utils libstdc++-14-doc libtool git make-doc -y
apt install wget libncurses5-dev build-essential zlib1g-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev libbz2-dev pkg-config -y
apt update && apt full-upgrade -y

Compiling Python

Download and compile Python 3.12:

wget https://www.python.org/ftp/python/3.12.2/Python-3.12.2.tgz
tar -xf Python-3.12.*.tgz
cd Python-3.12.*/
./configure --enable-optimizations
make -j $(nproc)
make altinstall

Verify the installation:

python3.12 --version

Installing Pip

Install pip for Python 3.12:

curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12

Verify pip:

pip3.12 -V

Use pip3.12 install <package> to install modules .

Setting Up and Running Your Bot

  1. Move your bot scripts/files into the Ubuntu environment (e.g., create a directory called bots).
  2. Navigate to your bot's directory.
  3. Create and activate a virtual environment:
python3 -m venv .venv && source .venv/bin/activate
  1. Install required pip modules for your bot.
  2. To run the bot in the background without deactivating the venv, prefix your bot's start command with one of the following:
    • nohup <your-bot-command> & (Recommended: Provides output, auto-restarts on crash).
    • setsid <your-bot-command>
    • disown <your-bot-command>
    • pm2 <your-bot-command> (If pm2 is installed via npm; install Node.js if needed).
  3. Enable wake lock via the Termux notification to keep the process running.
  4. Exit Termux using the exit command (do not close the notification). Your bot will now run persistently in the background until manually stopped.

Troubleshooting

  • If compilation fails, ensure all dependencies are installed and retry.
  • For wake lock issues, re-enter Termux, request wake lock again, and exit properly.
  • If your bot crashes, check logs (especially with nohup for output files like nohup.out).

Uninstall

Input the below command into Termux to get rid of the env.

wget https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Scripts/Uninstaller/Ubuntu/UNI-ubuntu.sh && bash UNI-ubuntu.sh

End Notes

Thank You
The DresOS Team
For questions or issues please contact us via our website: https://dresoperatingsystems.github.io/

About

This is our way of getting a docker like env on mobile hope this helps for advanced devs only

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published