Hacking labs
How to Create an Isolated Docker Network for Your Lab
Build a Docker network with no internet access, run OWASP Juice Shop on it, and publish a browser copy only on 127.0.0.1. Verify each step.
Build a home lab you are allowed to attack: a scope file, Docker ports bound to loopback, an isolated network, a notebook and a clean teardown.
A home lab is legal when every system you attack is yours, or belongs to someone who gave you written permission. Everything below follows from that one rule. Your own laptop, a virtual machine you created and a container you started are in scope. Your neighbor's Wi-Fi, your school network and "that site that looks vulnerable" are not, even when the test is harmless.
Write the rule down before you install anything. Authorization is easy to blur once a tool is running and a target looks interesting.
The commands below ran on Windows with Docker 29.8.2. Other versions may print slightly different text.
Keep the lab in one folder so you can find it and delete it later:
mkdir -p lab/notes
cd labCreate scope.md in that folder with the targets you allow yourself:
# Scope
Allowed targets:
- 127.0.0.1 (containers I started, ports bound to loopback)
Not allowed:
- Anything else, until I have written permission from its owner.It looks trivial. It still stops you from pointing a scanner at an address you never meant to test.
docker --versionDocker version 29.8.2, build 7fc2dffIf the command fails, install Docker first. If docker info says it cannot reach the daemon, start Docker Desktop or the Docker service and try again.
Containers are the easiest way to run vulnerable software without installing it on your system. The risk is the port mapping. Docker's port publishing documentation says that a -p mapping without an address makes the port available outside the host. A deliberately vulnerable app does not belong there.
Name the loopback address in the mapping. This example uses a plain web server image as a stand-in for a lab target:
docker run -d --rm --name lab-check -p 127.0.0.1:18080:80 caddy:2
docker port lab-check80/tcp -> 127.0.0.1:18080127.0.0.1:18080 means only your own machine can reach the port. Compare it with a mapping that has no address:
docker stop lab-check
docker run -d --rm --name lab-check -p 18081:80 caddy:2
docker port lab-checklab-check
80/tcp -> 0.0.0.0:18081
80/tcp -> [::]:18081Here Docker listens on 0.0.0.0 and [::], which are all interfaces. Whether other devices can actually reach it depends on your firewall and network, so do not rely on that. Put 127.0.0.1 in every lab command and check with docker port each time.
Some exercises need no network at all, such as reading a suspicious script or running a parser on a file. Docker's none network driver gives the container no network except loopback:
docker run --rm --network none alpine:3.22 ip -o link | cut -d' ' -f2lo:Only the loopback interface (lo) exists. Use --network none for anything you do not want talking to the outside, and treat a downloaded sample as hostile until you have read it.
Create one file per session in notes/. Write the date, the target, what you tried and what happened, in that order, while you work:
## 2026-01-15 14:20, first run
- Target: juice-shop-lab, http://127.0.0.1:3000
- Goal: see what a failed login returns
- Command: curl -i http://127.0.0.1:3000/rest/user/login
- Result: (paste what you saw, not what you expected)
- Next: ...The notebook has two jobs. It shows you what you did when a result surprises you, and it is the habit a real report starts from. Record the command you ran and the output you got. Do not paste output from a guide.
Stop what you started, then check that nothing is left:
docker stop lab-check
docker ps -a --filter name=lab-check --format '{{.Names}}'lab-checkdocker stop prints the container name. Because the container was started with --rm, Docker removes it after it stops, so the second command prints nothing. If you want the image gone as well, remove it with docker image rm. Delete the lab folder only when you no longer need the notes.
A lab you can rebuild in a few minutes is better than one you are afraid to touch.
You now have a scoped folder, a loopback habit and a way to stop. The next article, Run OWASP Juice Shop with Docker, uses this setup to start an intentionally vulnerable web application. Read the OWASP Juice Shop project page first so you know what you are running.
Hacking labs
Build a Docker network with no internet access, run OWASP Juice Shop on it, and publish a browser copy only on 127.0.0.1. Verify each step.
Hacking labs
Structure a pentest report and write one finding someone else can reproduce, with evidence, impact, a CVSS v4.0 vector and a fix.
Hacking labs
Run OWASP Juice Shop in a Docker container bound to your own machine, confirm it responds, and stop it cleanly.