<p>Right now my DOCKERFILE builds a dotnet image that is installed/updated and run inside its own pod in a Kubernetes cluster.</p>

<pre><code>FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
ARG DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
ARG DOTNET_CLI_TELEMETRY_OPTOUT=1
WORKDIR /app

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
ARG DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
ARG DOTNET_CLI_TELEMETRY_OPTOUT=1
ARG ArtifactPAT
WORKDIR /src

RUN apt-get update &amp;&amp; apt-get install -y wget &amp;&amp; rm -rf /var/lib/apt/lists/*

COPY /src .

RUN dotnet restore "./sourceCode.csproj" -s "https://api.nuget.org/v3/index.json"

RUN dotnet build "./sourceCode.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "./sourceCode.csproj" -c 
Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "SourceCode.dll"]
EXPOSE 80
</code></pre>

<p>The cluster is very bare-bones and does not include either curl nor wget on it. So, I need to get wget or curl installed in the pod/cluster to execute scripted commands that are set to run automatically after deployment and startup are completed. The command to do the install:</p>

<pre><code>RUN apt-get update &amp;&amp; apt-get install -y wget &amp;&amp; rm -rf /var/lib/apt/lists/*
</code></pre>

<p>within the DOCKERFILE seems to do nothing to install in the Kubernetes cluster. As after the build run and deploys if I were to exec into the pod and try to run </p>

<pre><code>wget --help 
</code></pre>

<p>I get wget doesn't exist. I do not have a lot of experience build DOCKERFILEs so I am truely getting stumped. And I want this automated in the DOCKERFILE as I will not be able to log into environments above our Test to perform the install manually. </p>

<p>its not related to kubernetes nor pods. Actually you cant install anything to kubernetes pod. you can install packages to containers which runs on pod.</p>

<p>Your problem is that, you install wget to your build image. when you use this image below you lost all installed packages. because those packages belong to build image. build, base, final they are different images.you need to copy files explicitly like you did final image. like this</p>

<pre><code>  COPY --from=publish /app .
</code></pre>

<p>so add command in the below to your final image and you can use wget without no problem.</p>

<pre><code>RUN apt-get update &amp;&amp; apt-get install -y wget &amp;&amp; rm -rf /var/lib/apt/lists/*
</code></pre>

<p>see this link for more info &amp;&amp; best practices.<br>
<a href="https://www.docker.com/blog/intro-guide-to-dockerfile-best-practices/" rel="nofollow noreferrer">https://www.docker.com/blog/intro-guide-to-dockerfile-best-practices/</a></p>
