Docker File Sample Flashcards

1
Q

Where does the docker file reside?

A

In root of the applciation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Pull ASP.NET Core 3.1 runtime and give the name ‘base’

A

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Set the ports where the container listens at runtime

A

EXPOSE 80
EXPOSE 443

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Pull the ASP.NET Core 3.1 SDK and give the name ‘build’

A

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the WORKDIR instruction?

A

The WORKDIR instruction sets the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD instructions that follow

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Set the Working Dir to ‘/src’.
This is where the source code is.

A

WORKDIR /src

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Copy projects

A

COPY [“Name.Of.Your.Project.csproj”, “Name.Of.Your.Project/”]
COPY [“Dependancy.Of.Your.Project.csproj”, “Dependancy.Of.Your.Project/”]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Run the application in a shell, in this case run ‘dotnet restore’

A

RUN dotnet restore “Name.Of.Your.Project/”Name.Of.Your.Project.csproj”

WORKDIR “/src/”Name.Of.Your.Project”
COPY . .
RUN dotnet build “Name.Of.Your.Project.csproj” -c Release -o /app/build

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Run the publish command using the SDK named as ‘build’

A

FROM build AS publish
RUN dotnet publish “Name.Of.Your.Project.csproj” -c Release -o /app/publish

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Pull ‘base’ image and name it as ‘final’ to allow pull access for publish

A

FROM base AS final
WORKDIR /app
COPY –from=publish /app/publish .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Set the entry point, in other words, what to run!

A

ENTRYPOINT [“dotnet”, “Name.Of.Your.Project.dll”]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly