
A lightweight, dependency-free bash script that gives you an emulated interactive shell inside a Docker container — using nothing but curl, dd, od, and awk. No Python, no jq, no editor required.
Built for environments where you only have raw shell access and need to exec commands inside a Docker container via the Docker Engine API.
Instead of using the Docker CLI, this script talks directly to the Docker Engine REST API over HTTP (typically exposed at http://192.168.65.7:2375 in Docker Desktop / WSL2 environments).
It:
C:\ drive mounteddd + od — no Python neededDocker wraps all exec output in a binary framing format:
[1 byte: stream type] [3 bytes: padding] [4 bytes: payload size (big-endian)] [payload...]
This script decodes that frame-by-frame using only standard Unix tools.
bashcurldd, od, awk, grep, cut — all standard Unix toolshttp://192.168.65.7:2375 (Docker Desktop on WSL2)No jq, no Python, no nano, no editor.
git clone https://github.com/yourusername/docker-shell.git
cd docker-shell
chmod +x docker_shell.sh
bash docker_shell.sh
================================================
Docker Emulated Shell [target: alpine_escape]
Commands: start | status | run <cmd> | exit
================================================
docker> start
docker> status
docker> run ls /mnt
docker> run ls /mnt/Users
docker> run cat /etc/os-release
docker> run id
docker> exit
The container mounts your Windows C:\ drive (via WSL2) at /mnt:
| Windows Path | Inside Container |
|---|
run is a separate exec instance — state does not persist between commands. Use run cd /some/dir && ls to chain commands in one call.alpine_escape), not by ID, so it won't accidentally exec into the wrong container./tmp/docker_out.bin using dd frame-by-frame.Edit these variables at the top of the script to match your environment:
DOCKER="http://192.168.65.7:2375" # Docker Engine API address
CONTAINER="alpine_escape" # Container name
AGPLv3
| Command | Description |
|---|
start | Creates (if needed) and starts the alpine_escape container |
status | Shows the container ID and current state |
run <cmd> | Executes any shell command inside the container |
exit / quit | Exits the emulated shell |
C:\ | /mnt |
C:\Users | /mnt/Users |
C:\Program Files | /mnt/Program Files |
C:\Windows\System32 | /mnt/Windows/System32 |