Level 6 — Practical projects · wrap-up
Cheat sheet & self-check
Every command from this section on one page.
Helper script
./app.sh up | Build both images and start them with Compose, wait until healthy |
./app.sh run | Same with plain docker: network, volume, two docker run commands |
./app.sh expose --open | Show the URLs for other machines and open the host firewall port |
./app.sh test | Health check, add a quote, list quotes through the front end |
./app.sh down / ./app.sh clean | Stop (keep data) / remove everything |
WEB_PORT=9090 BIND_ADDR=127.0.0.1 ./app.sh up | Another port, reachable only from this machine |
By hand
docker build -t quotes-backend:1.0 ./backend | Build the back end |
docker network create quotes-net | Network with DNS by container name |
docker run -d --name quotes-backend --network quotes-net --network-alias backend -v quotes-data:/data quotes-backend:1.0 | Back end: no -p, reachable only on the network |
docker run -d --name quotes-frontend --network quotes-net -p 8080:8080 quotes-frontend:1.0 | Front end: the only published port |
docker run --rm --network quotes-net curlimages/curl -s http://quotes-frontend:8080/api/quotes | Test from inside the network |
Linux containers
./app.sh up | Build and start both containers with Compose, wait until healthy |
./app.sh run | Same with plain docker run |
./app.sh expose --open | URLs for other machines; open ufw/firewalld |
./app.sh test / ./app.sh clean | Smoke test / remove everything |
Windows containers (PowerShell)
docker info --format '{{.OSType}}' | windows = Windows-containers mode |
& $Env:ProgramFiles\Docker\Docker\DockerCli.exe -SwitchDaemon | Switch Docker Desktop between Linux and Windows containers |
.\app.ps1 up | Build from Dockerfile.windows and start with compose.windows.yaml |
.\app.ps1 expose -Open | Add an inbound Windows Firewall rule (as Administrator) |
docker compose -f compose.windows.yaml up -d --build | The same without the helper |
docker run --isolation=hyperv ... | Run an image built for another Windows version in a lightweight VM |
.NET image details
mcr.microsoft.com/dotnet/sdk:10.0 | Build stage: SDK (large, never shipped) |
mcr.microsoft.com/dotnet/aspnet:10.0 | Run stage: ASP.NET Core runtime only |
USER $APP_UID | The non-root 'app' user built into .NET 8+ Linux images |
ASPNETCORE_HTTP_PORTS=8080 | Default listening port in .NET 8+ images |