Learn · Edition one · 15 minutes

Send your first notification from a Docker container

You will have an AI agent build a tiny container that sends a real phone notification through ntfy. Along the way you touch the whole platform loop: packaging, runtime, and observable output.

You need: Docker Desktop, a coding agent (Codex works), and optionally the ntfy app on your phone.

1 — Ask the agent to build it

Paste this into your agent:

Build a tiny notifier I can run in Docker.
A Python script, notify.py, that POSTs its first command-line
argument to https://ntfy.sh on a topic from NTFY_TOPIC
(default: strattegys-hello-CHANGEME). Print the response status.
Plus a Dockerfile based on python:3.12-slim that copies the
script and runs it. Keep everything under 30 lines total.

2 — Check what it made

You should get something close to this. Read it before you run it — never run agent-written Dockerfiles blind:

import os, sys, urllib.request

topic = os.environ.get("NTFY_TOPIC", "strattegys-hello-CHANGEME")
message = sys.argv[1] if len(sys.argv) > 1 else "Hello from Docker"
req = urllib.request.Request(
    f"https://ntfy.sh/{topic}",
    data=message.encode(),
    headers={"Title": "First container ping"},
    method="POST",
)
with urllib.request.urlopen(req, timeout=15) as res:
    print("ntfy:", res.status)
FROM python:3.12-slim
WORKDIR /app
COPY notify.py .
CMD ["python", "notify.py"]

3 — Build and run it

docker build -t ntfy-hello .
docker run --rm -e NTFY_TOPIC=pick-a-secret-topic-name \
  ntfy-hello "Hello from my first container"

Open ntfy.sh/pick-a-secret-topic-name in a browser (or subscribe in the ntfy app) and your message is waiting. That round trip — packaged code, real runtime, visible output — is the whole platform idea in miniature.

Bonus — Teach it something useful

Ask the agent to add a disk-space check that notifies you when usage passes 90%. Same container, same pattern, now it earns its keep.

What you just practiced

  • Packaging: one Dockerfile turns a script into a portable artifact.
  • Runtime: environment variables carry secrets without touching code.
  • Observability: a notification is the smallest possible proof the system works.

Sponsorship

Your brand here

A founding sponsor placement.

Sponsorship

Your brand here

A founding sponsor placement.

← Back to Learn