JMK
JMK

Reputation: 28069

Docker not hosting anything on the port it says it is, what's going on?

I am working through this blog post which explains how to host a sample ServiceStack app on .net core via Docker.

In the command line I see:

Now listening on: https://*:5000

But as shown in the below screenshot, nothing seems to be hosted on localhost port 5000.

Docker not hosting anything

I have tried this on my Mac and PC and it's the same result.

I am brand new to Docker so I'm assuming this something obvious on my part so apologies for the noob question!

Thanks

Upvotes: 2

Views: 238

Answers (1)

Tseng
Tseng

Reputation: 64229

By default docker containers do not expose any ports to the world outside of the container. When you start a container, you need to add a port mapping similar to NAT so it can be reached form outside (docs).

When you run docker run you need to pass the port mappings via -p IP:host_port:container_port parameter, i.e. docker run -p 443:5000. Then connect to it via https://localhost (https is on port 443).

Upvotes: 4

Related Questions