Modern Docker Made Easy: Real Apps, Volumes, and Live Resource Updates
Raju Dandigam

Raju Dandigam @raju_dandigam

About: Engineering Manager with over 13 years of experience transitioning from a front-end engineer to a leadership role. Expertise in developing innovative front-end solutions, leading full-stack teams, and

Location:
Palo Alto, CA
Joined:
Jul 3, 2024

Modern Docker Made Easy: Real Apps, Volumes, and Live Resource Updates

Publish Date: Jun 22
0 2

Docker remains a cornerstone of modern dev and DevOps workflows. With Docker Desktop 4.42, released in June 2025, Docker now offers native IPv6, built-in MCP Toolkit, and expanded Model Runner AI capabilities—features that significantly enhance real-world development environments

In this guide, we will build a containerized app featuring persistent data, runtime tuning, monitoring, security, and more—with commands and concepts oriented toward professional use.

1. The Practical Value of These Docker Concepts

  • Network parity: IPv6 support eliminates environment discrepancies and future-proofs setups .
  • AI workflows: With docker model… commands, you can pull and test LLMs locally from the CLI .
  • Service catalog: The integrated MCP Toolkit gives instant access to 100+ tools—like GitHub, MongoDB—isolated in secure containers
  • Pro-grade features: This demo includes dynamic resource updates, monitoring, lifecycle control, and cleanups.

2. The Mini-App: Ping Counter

We’ll run a Node.js script that reads and increments a counter in counter.json:

project/
├─ Dockerfile
├─ counter.json  ← initializes as {"value":0}
└─ index.js
Enter fullscreen mode Exit fullscreen mode
const fs = require('fs');
const data = JSON.parse(fs.readFileSync('./counter.json'));
data.value += 1;
fs.writeFileSync('./counter.json', JSON.stringify(data));
console.log(`Count is now ${data.value}`);
Enter fullscreen mode Exit fullscreen mode

This simple script demonstrates containers, images, volumes, monitoring, and dynamic tuning.

3. Build the image

Dockerfile:

FROM node:20-alpine
WORKDIR /app

COPY package.json .
RUN npm install --production
COPY . .

CMD ["node", "index.js"]
Enter fullscreen mode Exit fullscreen mode

Build and inspect:

docker build -t ping-counter:1.0 .
docker images
Enter fullscreen mode Exit fullscreen mode

This highlights Docker’s layered approach and the modern docker image command suite.

4. Initial Run (Stateless)

echo '{"value":0}' > counter.json
docker run --name no-store ping-counter:1.0
# → Count is now 1
docker run --name no-store2 ping-counter:1.0
# → Count resets to 1
Enter fullscreen mode Exit fullscreen mode

Shows that containers default to a fresh state every run.

5. Add Persistence via Volumes

docker run -d \
  --name counter \
  -v counter_data:/app/counter.json \
  ping-counter:1.0
docker logs counter           # → Count is now 1
docker restart counter && docker logs counter  # → Count increments
Enter fullscreen mode Exit fullscreen mode

Volumes allow state persistence beyond container lifecycles—key for real-world apps.

6. Dynamic Runtime Tuning

Modify CPU and memory limits on the fly:

docker update --cpus="0.5" --memory="128m" counter
Enter fullscreen mode Exit fullscreen mode
  • This live update doesn't require a container restart
  • Flags like --cpus, --memory, and --cpu-shares manage cgroup constraints

7. Live Monitoring

docker stats counter
Enter fullscreen mode Exit fullscreen mode

Monitors runtime resource consumption. For deeper analytics, integrate Docker Desktop’s Resource Usage or Prometheus/OpenTelemetry .

8. Rebuild & Redeploy

If you change index.js to increment by five instead, do:

docker build -t ping-counter:1.1 .
docker stop counter && docker rm counter
docker run -d \
  --name counter \
  -v counter_data:/app/counter.json \
  ping-counter:1.1
docker logs counter  # → reflects new count
Enter fullscreen mode Exit fullscreen mode

9. Clean-Up & Security

docker ps -a
docker images
docker volume ls
Enter fullscreen mode Exit fullscreen mode

Clean unused:

docker rm no-store no-store2
docker rmi ping-counter:1.0
docker volume prune
Enter fullscreen mode Exit fullscreen mode

Security best practices:

  • Use curated/hardened base images.
  • Scan using Docker Scout or Trivy.
  • Implement SBOM and image signing

10. Advanced Concepts Snapshot

  • Health checks (HEALTHCHECK) to detect container readiness.
  • Non-root execution enhances runtime security.
  • IPv6 toggling within Docker Desktop network settings
  • AI model experimentation: use docker model pull and docker model run.
  • MCP Toolkit: run MCP tools via docker mcp or UI

Conclusion

In this guide, we built a real-world Dockerized app from scratch—covering images, containers, persistent volumes, live resource tuning, monitoring, and security best practices. We also touched on modern features like IPv6 support and AI model tooling.

With this foundation, we’re now equipped to apply Docker confidently in professional workflows—and ready to take the next step into orchestration, CI/CD, or advanced container security.

Comments 2 total

Add comment