From the course: Deploying ASP.NET Core Applications

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Test the Docker image locally

Test the Docker image locally

From the course: Deploying ASP.NET Core Applications

Start my 1-month free trial

Test the Docker image locally

- [Instructor] Now that we've built an image with Docker build, we can test it on our local machine. First use Docker images to list the images that are available, hellocoreworld is the name of the image I created before. I can run this image using Docker run. I'll use the -it flag to tell Docker to take all of the output from the container and pipe it to this console window. I'll also use the -p flag to map port 5000 from inside of the container, which was exposed with the expose command in the Docker file, to port 5000 on this machine, on my local machine. And finally I'll specify the name of the image that I want to spin up. When I hit enter, Docker will take this image, create a container from it, and then run the container and show me the output. And it works really fast, so in just that amount of time I have the container spun up, Kestrel started up, and it's listening for requests. If I switch over to a browser and browse to localhost5000, I should start interacting with that…

Contents