This example demonstrates the .NET Core Web API for managing video games.
This guide explains how to build and run the VideoGame Web API using Docker.
docker build -t videogameapi-image .docker build: Builds a Docker image from the Dockerfile in the current directory (.).-t videogameapi-image: Tags the image with the namevideogameapi-image.
docker run -it --rm -p 3000:8080 --name Videogame-cont videogameapi-imagedocker run: Runs a container from the built image.-it: Enables interactive mode with a terminal.--rm: Automatically removes the container when it exits.-p 3000:8080: Maps port8080in the container to port3000on the host.--name Videogame-cont: Assigns the nameVideogame-contto the container.videogameapi-image: The image to run.
After running these commands:
-
The
VideoGameWeb API will be accessible at:
http://localhost:3000 -
Once the container stops, it will be automatically removed (due to
--rm).