5.Troubleshoot Docker Container Issue

Published: (February 4, 2026 at 05:30 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

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 to 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.

Steps

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",
        ...
    }
]

✅ This confirms the volume is correctly mapped.

Step 2: Verify port mapping

Still inside the docker inspect output, check Ports:

"Ports": {
    "80/tcp": [
        {
            "HostIp": "0.0.0.0",
            "HostPort": "8080"
        }
    ]
}

✅ This confirms container port 80 is mapped to host port 8080.

Step 3: Verify website accessibility (MANDATORY)

Run on App Server 1:

curl http://localhost:8080/

Expected result when the container is stopped

curl: (7) Failed to connect to localhost port 8080: Connection refused

Fix it

docker ps               # confirm container status
docker start nautilus   # start the container if stopped
docker ps
docker port nautilus    # verify the port mapping
curl http://localhost:8080/

Expected result after the fix

Welcome to xFusionCorp Industries!

Part 2: Simple Step‑by‑Step Explanation (Beginner Friendly)

We are verifying two things only:

  1. File connection (volume mapping)
  2. Network connection (port mapping)

Volume Mapping Explained

  • Website files live on the host: /var/www/html
  • Apache inside the container reads from: /usr/local/apache2/htdocs
  • The volume mapping connects them like a shared folder.
    If the mapping is correct, updating files on the host updates the website instantly.

Port Mapping Explained

  • Apache listens on port 80 inside the container.
  • Docker exposes it as port 8080 on the host.

Thus, curl http://localhost:8080/ means “Ask the container’s Apache server for the website.”

Exam Memory Hook

Inspect → Mounts → Ports → Curl
If curl works, everything is wired correctly.

Resources & Next Steps

  • 📦 Full Code Repository: KodeKloud Learning Labs
  • 📖 More Deep Dives: Whispering Cloud Insights
  • 💬 Join Discussion: DEV Community
  • 💼 Connect on LinkedIn

Credits

  • All labs are from: KodeKloud
Back to Blog

Related posts

Read more »