Image of asp.net core 3.1 Web API App using Entity Framework Core 3.1 and SQL Server 2017
199
This a Docker image of Web API named BookStoreAPI developed with asp.net core 3.1 using Entity Framework Core 3.1 and SQL Server 2017 as back-end to demonstrate simple out of the box CRUD operations.
Docker should be setup on your machine.
1- Create docker-compose file.
Get the docker-compose.yml file from my GitHub repo - https://github.com/sanjaysaini2000/aspnet-core3-webapi/blob/master/docker-compose.yml and save the content in docker-compose.yml on your machine.
2- Pull the images
Open the command terminal on the path of docker-compose.yml and run following command.
docker-compose pull
3- Start the app
Run following command to create/run the containers
docker-compose up
Note - It will take same time for sql server to get ready so API will keep trying to connect to it before you get the following output on the terminal.
Apply init migration...
Adding initial data...
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://[::]:80
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: /app
4- Now open the browser and type in the address bar http://<host URL>:8000/api/BookItems
E.g. http://192.168.99.100:8000/api/BookItems
You will get 2 pre-populated records . Now you can use POSTMAN tool to add/delete/update/get bookitems from SQL Server DB through this API.
Note - You can get host URL by running "docker-machine IP" command.
5- To kill and remove the container run following command
docker-compose down
Content type
Image
Digest
Size
90.3 MB
Last updated
about 6 years ago
docker pull sanjaysaini2000/aspnetcorewebapi