0% found this document useful (0 votes)
10 views1 page

Notes On Docker

Uploaded by

saiakkina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Notes On Docker

Uploaded by

saiakkina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Docker runs on any OS.

Run it on Windows, MacOS and CentOS, rather than Ubuntu

================================

1. At first, I installed docker on my machine.

2. After installing, I ran a simple container using the command "docker run hello-
world"

================================

1. I created an asp.net core project through CLI, which created an application from
the template.

$ dotnet new razor -o ASPNetCoreOnDocker

2. Now I moved into the project folder and ran the below command (same as F5 on
Visual Studio).

$ cd ASPNetCoreOnDocker
$ dotnet run

================================

I have pulled 2 images aspnetcore and aspnetcore-build images from the docker hub

$ docker pull microsoft/aspnetcore-build:2.0.0


$ docker pull microsoft/aspnetcore:2.0.6

I have run the below command to check the docker images on my machine

$ docker images

================================

Now, I created a Dockerfile under my ASPNetCoreOnDocker application using VSCode


with the following code

FROM microsoft/aspnetcore-build:2.0.0 AS build # Image to build the code. Add a


name to it (AS build) to reference it later.
WORKDIR /code # Setup the working directory /code.
COPY . . # Copy the content which is beside the current Dockerfile to the working
directory.
RUN dotnet restore # To restore the NuGet packages and dependencies to build the
application.
RUN dotnet publish --output /output --configuration Release # Executable gets
created and stored in /output and choose either "Debug/Release" config.
FROM microsoft/aspnetcore:2.0.6 # Image to run the executable.
COPY --from=build /output /app # Copy the executable from the referenced image,
from /output directory to /app in the current image to /app directory.
WORKDIR /app # Setup the working directory /app.
ENTRYPOINT ["dotnet","ASPNetCoreOnDocker.dll"] #

================================

You might also like