Linux Labs

Containers: Docker and compose / Stage 5 of 11

Volumes: data outlives the container

Not running Starting usually ~20 s
Leave the lesson

Step 5 of 7 · on a machine · 5 min

A report through nginx

You will serve a host directory through nginx — in another image, where requests are handled by a user other than root.

Every morning a fresh report appears in ~/report, and it has to be served over HTTP through nginx from the nginx:alpine image. There is no point in rebuilding the image for each report — let the container see the host directory. nginx in this image serves files from /usr/share/nginx/html and listens on port 80. The main nginx process runs as root, while requests are handled by worker processes running as the nginx user, UID 101.

Exercise · do it

Serve the report through nginx

Run a report container from the nginx:alpine image with the ~/report directory in place of /usr/share/nginx/html so that the report opens on port 8081. You stay the owner of index.html, and the owner alone may write to it.

Sign in and start The machine is available after signing in

Goals · 0 of 2

  • Run report with the ~/report directory not done yet
  • Serve the report on port 8081 not done yet

Step goals

0 of 2
  • Run report with the ~/report directory — not done yet
  • Serve the report on port 8081 — not done yet
Ubuntu 24.04

Step goals

0 of 2
  • Run report with the ~/report directory — not done yet
  • Serve the report on port 8081 — not done yet
Loading…