Lab Information
An issue has arisen with a static website running in a container named nautilus on App Server 1. To resolve the issue, investigate the following details:
Check if the container's volume /usr/local/apache2/htdocs is correctly mapped with the host's volume /var/www/html.
Verify that the website is accessible on host port 8080 on App Server 1. Confirm that the command curl http://localhost:8080/ works on App Server 1.
Lab Solutions
π Step 0: Login to Application Server 1
ssh tony@stapp01
Password:
Ir0nM@n
π Step 1: Check volume mapping of the container
docker inspect nautilus
Focus on the Mounts section.
You should see something like:
"Mounts": [
{
"Source": "/var/www/html",
"Destination": "/usr/local/apache2/htdocs",
"Type": "bind"
}
]
β This confirms the volume is correctly mapped.
π Step 2: Verify port mapping
Still inside docker inspect output, check Ports:
"Ports": {
"80/tcp": [
{
"HostPort": "8080"
}
]
}
β This confirms container port 80 is mapped to host port 8080.
π Step 3: Verify website accessibility (MANDATORY)
Run on App Server 1:
Expected result
[tony@stapp01 ~]$ curl http://localhost:8080/
curl: (7) Failed to connect to localhost port 8080: Connection refused
Fix it
docker ps
docker start nautilus
docker ps
docker port nautilus
curl http://localhost:8080/
Expected result
[tony@stapp01 ~]$ curl http://localhost:8080/
Welcome to xFusionCorp Industries!
π§ Part 2: Simple Step-by-Step Explanation (Beginner Friendly)
πͺ What are we checking?
We are verifying two things only:
File connection (volume mapping)
Network connection (port mapping)
π Volume Mapping Explained
Website files live on the host:
/var/www/html
Apache inside container reads from:
/usr/local/apache2/htdocs
Volume mapping connects them like a shared folder
If mapping is correct:
Updating files on host updates website instantly
π Port Mapping Explained
Apache listens on port 80 inside container
Docker exposes it as port 8080 on host
So:
means:
βAsk the containerβs Apache server for the website.β
π§ Exam Memory Hook
Inspect β Mounts β Ports β Curl
If curl works, everything is wired correctly.
Top comments (0)