Signal9Signal9 — home
online
back to labs

Docker Compose: Declare a Web Service

MediumDevOps15-20 min
The brief

Declare an nginx web service as code with Docker Compose instead of a fragile one-off 'docker run'. Read /root/case/assignment.env for the host port (HOST_PORT) to publish. Edit /root/case/docker-compose.yml to define a 'web' service that runs the nginx image, publishes HOST_PORT to the container's port 80, and restarts automatically (restart: always) so it comes back after a crash or reboot. Grading reads the compose file.

What you'll do
  • Define a web service using the nginx image
  • Publish the assigned host port to container port 80
  • Set a restart policy so the service self-heals

Hands-on lab: you work on a real Linux box in your browser, graded on the machine's actual state.