Repository navigation
Integrating Docker
Docker is a service that allows an application to run in a "container." A Docker container can run on any computer that has Docker installed, which means that we can eliminate dependencies that come along with running an application in different environments (such as moving from staging to production).
Install Docker on your computer.
Once you have Docker installed you will need to download a Docker image. In Docker, an image is essentially a snapshot of a running operating system that is called a container. A container is just a running instance of an image.
- To view the images that you have on your computer, run
docker imagesin your command prompt. - To view running containers, run
docker ps -ain your command prompt. This also gives you information about stopped containers.
Downloading images requires using the docker pull command.
In a command prompt, run docker pull microsoft/aspnetcore. This downloads Microsoft's latest ASP.NET Core Docker image that has all of the necessary dependencies preinstalled for running a .NET Core application.
To run the image that you have just downloaded, we will be using the docker run command.
First, explore what the -i and -t arguments do with docker run.
Next, run the following command:
docker run -i -t microsoft/aspnetcore
Notice that you are in a Linux environment, and can use it as you would Linux.
To close the container, type exit and hit enter.
Navigate to the "Web" directory of your project.
- Create a file named
Dockerfile
Will add more steps later...