A Python-based CLI tool for managing Docker development containers with consistent environments and configurations.
- Create, start, stop, and manage Docker containers
- Workspace mounting and port forwarding
- User management with non-root execution
- Cache management and container rebuilding
- Environment variable configuration
- Startup script execution
- Python 3.6+
- Docker installed and running
- Proper file structure:
root/ ├── drun/ │ └── templates/ │ └── Dockerfile.template └── projects/ └── [container-name]/ └── Dockerfile
python3 script.py <operation> <container-name> [options]
create
: Create and start new containerstart
: Start existing containerstop
: Stop running containerrestart
: Restart containerclean
: Restart with cache clearreset
: Remove and recreate containernuke
: Full rebuild from scratch
--username
: Container username (env: DOCKER_USER)--password
: User password (env: DOCKER_PASS)--workspace
: Local workspace path (env: DOCKER_WORKSPACE)--startup-script
: Startup script path (env: DOCKER_STARTUP)--ports
: Port forwards as host:container (env: DOCKER_PORTS)--root
: Run as root user (env: DOCKER_ROOT)--debug
: Debug level (0-4)
DOCKER_USER
: Default username (default: "developer")DOCKER_PASS
: Default password (default: "password")DOCKER_WORKSPACE
: Default workspace path (default: "./workspace")DOCKER_ROOT
: Run as root by default (default: "0")DOCKER_PORTS
: Default port mappings (format: "host1:container1,host2:container2")DOCKER_STARTUP
: Default startup script pathDOCKER_DEBUG
: Default debug level (default: "0")
- Create a new container:
python3 script.py create mydev --workspace ~/projects/mydev --ports 8080:80 3000:3000
- Start existing container:
python3 script.py start mydev
- Reset with custom user:
python3 script.py reset mydev --username devuser --password devpass
- Clean restart with startup script:
python3 script.py clean mydev --startup-script init.sh
Use the --debug
flag with levels 0-4 for increasing verbosity:
python3 script.py create mydev --debug 2
- Container configurations are stored in
projects/<container-name>/
- Default Dockerfile template in
drun/templates/Dockerfile.template
- Workspace is mounted at
/home/<username>/workspace
- Workspace mounting persists across container starts/stops
- Validates container existence before operations
- Reports build and execution errors
- Handles port conflicts and permission issues
- Provides debug output for troubleshooting