I recently started learning docker.

i downloaded the httpd image from docker hub and mounted external source on containers "/var/www/html" and ran the container on host

docker run -dit --name mywebsite -p 8080:80 -v /home/sysadmin/site/:/var/www/html/ httpd:2.4

CONTAINER ID        IMAGE               COMMAND              CREATED             STATUS              PORTS                  NAMES
4ddc01da41ef        httpd:2.4           "httpd-foreground"   2 days ago          Up 2 days >80/tcp   mywebsite

Now when i check using interactive terminal using "docker exec 4dd cat /var/www/html/index.html" i can see the index file is available in webserver DocumentRoot.

but when try to access from Host using curl command

curl localhost:8080 , it says file not found

404 Not Found

Not Found

The requested URL was not found on this server.

Firewall and SELinux are not running on Host

  • HTTP status code 404 is an answer from the server, so your network connection is not an issue. You are trying to load the index file without mentioning its name. Is the value of the directive DirectoryIndex set appropriately? – rexkogitans Oct 9 '19 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.