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 8085 on App Server 1. Confirm that the command curl http://localhost:8085/ works on App Server 1.
Step-by-Step Investigation
1. SSH into Application Server 1
ssh tony@stapp01
Password: Ir0nM@n
3. Check the container status
sudo docker ps | grep nautilus
If the container isn't running, check all containers:
sudo docker ps -a | grep nautilus
4. Verify Volume Mapping
Check the container's volume configuration:
Method 1: Using docker inspect
sudo docker inspect nautilus | grep -A 5 -B 5 "Mounts"
Method 2: Simple check
sudo docker inspect nautilus | grep -i "source\|destination"
This should show:
-
Source:
/var/www/html(host path) -
Destination:
/usr/local/apache2/htdocs(container path)
5. Verify Host Volume Contents
Check if the host volume has content:
ls -la /var/www/html/
If there's an index.html or other website files, check them:
cat /var/www/html/index.html
6. Verify Container Volume Contents
Check the container's mounted volume:
sudo docker exec nautilus ls -la /usr/local/apache2/htdocs/
Check if the website file exists:
sudo docker exec nautilus cat /usr/local/apache2/htdocs/index.html
7. Check Port Mapping
Verify the container's port mapping:
sudo docker port nautilus
Or using docker inspect:
sudo docker inspect nautilus | grep -A 10 "PortBindings"
Look for port mapping showing 8085 mapped to container's port 80 (or 443).
8. Test Website Accessibility
Test from the host:
curl http://localhost:8085/
Test with verbose output for more details:
curl -v http://localhost:8085/
Check if Apache/HTTP server is responding:
curl -I http://localhost:8085/
9. Check if the website is accessible from the container itself
sudo docker exec nautilus curl http://localhost/
Common Issues and Solutions
| Issue | Possible Cause | Solution |
|---|---|---|
| Volume not mounted correctly | Wrong path or missing -v flag |
Check docker run command and remount |
| Host volume empty | No files in /var/www/html/
|
Add website files to host directory |
| Port not accessible | Wrong port mapping or Apache not running | Check docker port and container logs |
| Website returns error | Apache configuration issue | Check container logs: docker logs nautilus
|
| Container not running | Container crashed or stopped | Start container: docker start nautilus
|
Additional Troubleshooting
Check Container Logs
sudo docker logs nautilus
Check Apache Processes Inside Container
sudo docker exec nautilus ps aux | grep httpd
Test with Different Methods
# Test with curl and follow redirects
curl -L http://localhost:8085/
# Test with wget
wget -O- http://localhost:8085/
Expected Successful Output
If everything is configured correctly:
-
Volume Mapping should show:
- Source:
/var/www/html→ Destination:/usr/local/apache2/htdocs
- Source:
-
Port Mapping should show:
-
0.0.0.0:8085→ container port80
-
curl http://localhost:8085/ should return the website content (HTML, text, etc.)
Top comments (0)