.NET Tutorial - Your First Microservice

Run Docker image

You can run your app in a container using the following command :

Command prompt
docker run -it --rm -p 3000:80 --name mymicroservicecontainer mymicroservice

You can browse to the following URL to access your application running in a container: http://localhost:3000/WeatherForecast

The API endpoint returns JSON data containing weather forecast information

Optionally, you can view your container running in a separate command promptterminal window using the following command:

Command prompt
docker ps

A list of running docker images with information about each of them.

Press CTRL+C on your command prompt to end the docker run command that is running the service in a container.

Press CTRL+C on your terminal to end the docker run command that is running the service in a container.

Congratulations! You've successfully created a small, independent service that can be deployed and scaled using Docker containers.

These are the fundamental building blocks of microservices.

Continue