The High Risk of Running Code Locally - Here's How to Secure Projects with Docker in One Command

If security is a priority for you, running applications directly on your local machine can introduce notable risks, particularly as you start managing an increasing number of projects and supply chain security becomes a significant concern. Docker can greatly reduce this risk by isolating applications within secure containers.
The problem? Using Docker typically requires writing Dockerfiles, docker-compose configs, and other setup. While powerful tools like Docker Compose and orchestrators like Kubernetes exist to manage these complexities, they all require configuration. For quick, small projects, I'm often too lazy to set all that up - but I don't want to give up the security benefits either.
The ideal solution would be simple: run your application in Docker so it acts just like it's running locally, but within a secure, isolated space. To achieve this, I developed a straightforward script. It lets you run common Python and Node.js applications by simply typing dockerun
in your project folder, and it handles the rest automatically.
What dockerun
Does
dockerun
is a single Python script designed to:
- Automatically find out if your project is written in Python or Node.js.
- Identify where your application starts (its entry point) and which network port it uses, all on its own.
- Launch your application inside Docker containers without you needing to set up anything.
- Store project dependencies (like libraries) locally for each project, speeding up future runs.
How It Works

Simply open your project's folder in your terminal and type dockerun
:
cd my-flask-app
dockerun
# Auto-detects Python, finds main.py, runs on port 5000
cd my-nextjs-app
dockerun
# Auto-detects Node.js, runs npm run dev on port 3000
This tool searches for standard project files (like requirements.txt
for Python or package.json
for Node.js), figures out how your application starts, identifies its port, and then puts together the right Docker command to make it run effortlessly.
Key Capabilities
- Project Recognition: It can tell if your project is Python (by looking for files like
requirements.txt
orpyproject.toml
) or Node.js (checking forpackage.json
oryarn.lock
). - Intelligent Start-Up: It automatically finds common Python entry points like
main.py
,app.py
, orserver.py
. For Node.js, it looks at the scripts defined in yourpackage.json
file. - Port Identification: The tool scans your code to find out which network port your application uses. If it can't find one, it uses standard default ports.
- Project-Specific Caching: To save time, it creates cache folders (
.pip-cache/
or.npm-cache/
) within each project. This means dependencies aren't downloaded and installed repeatedly every time you run the application. - Framework Understanding: It knows how to work with popular frameworks like Django, Flask, FastAPI, and Next.js, adjusting its behavior as necessary.
Example Usage
Here are some ways you can use dockerun
:
# Basic usage
dockerun
# Override port
dockerun --port 8080
# Override entry point
dockerun --entry custom_server.py
# See what it would run
dockerun --dry-run
# Use different Python/Node version
dockerun --python-version 3.9
dockerun --node-version 16
Why This Tool Was Created
I created this tool because I was tired of:
- Having to write Dockerfiles just for quick tests.
- Trying to remember various run commands for different projects.
- Setting up complex
docker-compose
configurations just to try something out. - Waiting for
npm
orpip
to install dependencies every time a container restarted.
Now, running any project in Docker is as simple as typing dockerun
. There are no configuration files or lengthy setups required; it simply works.
Installation
To get started, download the script and make it executable:
# Download from Hugging Face
wget https://huggingface.co/[username]/dockerun/raw/main/dockerun
# Make executable and add to PATH
chmod +x dockerun
mv dockerun ~/.local/bin/
When to Use dockerun
(and When Not To)
While dockerun
is designed for simplicity and speed, it comes with certain limitations and is best suited for specific use cases:
- Currently, it only supports Python and Node.js projects.
- It expects your projects to follow common or standard directory layouts.
- This tool is not designed for deploying applications to a live production environment.
- The Docker containers launched by
dockerun
run with root privileges. - It does not support complex setups involving multiple interconnected services.
For larger applications or production environments, more robust and comprehensive tools are necessary. However, dockerun
excels in quickly spinning up single-service applications for proof-of-concept (PoC) development, focused local testing, or rapid prototyping, where speed and minimal setup are the top priorities.
Under the Hood
The script is built using a modular system. This means each type of project (like Python or Node.js) has its own dedicated handler, which takes care of detecting the project, finding its starting point, and constructing the correct Docker command. This design makes it straightforward to add support for new programming languages such as Go, Rust, or others, simply by creating new handler classes.
Download
The tool is available for free on GitHub. It's a single Python file with no dependencies beyond the standard library.
Contributing
If you find this tool useful, contributions are welcome! The codebase is designed to be easily extensible – adding support for new languages just requires implementing a new handler class. Whether it's bug fixes, new language support, or improvements to the detection logic, pull requests are appreciated.