Docker Port and Volume Redirection Issue

In order to use the index .html from my localhost on my new container, i used this command

docker run -d -p 8080:80 --name=WebServer8 -v /home/user/www:/usr/share/nginx/html nginx:latest


But, somehow my index.html page is not showing up when i run elinks http://localhost:8080. It still shows the original index.html from nginx container.

Am i missing anything?

Thank You!!
  • post-author-pic
    Ali M
    11-19-2018

    Can you confirm where your index.html file is located on the host machine?

  • post-author-pic
    Vishal S
    11-19-2018

    It is under /home/user/www (attached image)

    user_400016_5bf2bf90cc85e.jpg_800.jpg

  • post-author-pic
    Vishal S
    11-19-2018

    Update....

    I just tried it again and it worked. No changes in the file or command. Only difference is my host server was restarted between yesterday and today. Would that make it work? Thank you for your help!

  • post-author-pic
    Ali M
    11-20-2018

    No Vishal, restart shouldn't have been required. There might be some other underlying cause. In any case, it's great that it worked out for you.

  • post-author-pic
    Vishal S
    11-26-2018

    Thank you!

Looking For Team Training?

Learn More