Can't connect to container on localhost with port mapping

I have the detailed form of the same issue in the given link

And I also tried with tutorials available in JavaTpoint

Yet I cant fix this…