Skip to content

Integrating Docker

Evan Schallerer edited this page May 11, 2017 · 5 revisions

Overview

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).

Getting Started with Docker

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 images in your command prompt.
  • To view running containers, run docker ps -a in your command prompt. This also gives you information about stopped containers.

Download an Image

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.

Running an Image

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.

Deploying your application to Docker

Navigate to the "Web" directory of your project.

  • Create a file named Dockerfile

Will add more steps later...

Clone this wiki locally