01 — The Problem
💀 The Problem Nobody Talks About
You fire up Kali. You need Python 2.7. Your system laughs and spits out Python 3.x.x.
So you Google it — and find three kinds of advice. All of them wrong.
❌
"Uninstall Python 3"
Kali depends on it. Your whole system breaks. Have fun.
❌
"Use pyenv"
2 hours of config pain for something Docker does in 10 seconds.
❌
"Edit .zshrc"
Shell configs are sacred. Keep your hands off.
💡 The real answer? Spin up a Docker container. Mount your folder inside it. Get Python 2.7. Leave everything else completely alone. One command. Zero side effects.
02 — The Command
⚡ The One Command That Does It All
Navigate into your project folder and fire this. You land inside a live Python 2.7 shell — isolated, clean, scoped only to that folder.
bash
$
sudo docker run -it -v "$PWD:/app" -w /app python:2.7-slim bash
root@a3f2c1d0e5b8:/app#
← inside the bubble now 🫧
Your Kali system outside? Untouched. Unbothered. Still on Python 3. Here's what each flag does:
| Flag | What It Does |
|---|---|
| -it | Interactive terminal — gives you a live shell |
| -v "$PWD:/app" | Mounts your folder ↔ /app inside the container |
| -w /app | Sets /app as the working directory on entry |
| python:2.7-slim | Official lightweight Python 2.7.18 image |
| bash | Opens a shell, not the Python REPL directly |
03 — Setup
🛠️ Full Setup — Don't Skip Steps
1
Install Docker
bash
$ sudo apt update
$ sudo apt install -y docker.io
2
Start the engine
bash
$ sudo systemctl enable --now docker
3
Enter your project folder
bash
$ cd ~/your-project-folder
4
Launch the bubble 🫧
bash
$ sudo docker run -it -v "$PWD:/app" -w /app python:2.7-slim bash
✓ You're in. Welcome to 2.7. 🐍
04 — Inside
✅ Once You're Inside
bash
$ python --version # Python 2.7.18 ✓
$ python script.py # run your script
$ pip install requests # install packages normally
The part that feels like magic — files in your project folder appear instantly at /app inside the container. Edit from either side — changes show up on both. No syncing. No copying. No pain.
Your Kali Machine
~/your-project/
script.py
output.log
script.py
output.log
⟷
The Docker Bubble
/app/
script.py
output.log
script.py
output.log
05 — Safety
🛡️ What Stays Completely Untouched
| Component | Status |
|---|---|
| System Python 3 | ✅ Completely untouched |
| Kali tools & packages | ✅ Not affected at all |
| .zshrc / shell config | ✅ Never even opened |
| Your project files | ✅ Accessible from both sides |
| Your sanity | ✅ Intact |