<p>First off, let me start by saying I am fairly new to docker and trying to understand the dockerfile setup.</p>

<p>We are currently trying to convert our existing WepApi services to support containerization and orchestration.  The plan is to use Docker with Kubernetes.  We currently utilize multiple publish profiles with then drive the WebConfig based on the selected publish profile.</p>

<p>Looking through the dockerfile, I see stuff such as:</p>

<pre><code>RUN dotnet restore 
"Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj"
COPY . .
WORKDIR "/src/Aeros.Services.Kubernetes"
RUN dotnet build "Aeros.Services.Kubernetes.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "Aeros.Services.Kubernetes.csproj" -c Release -o /app
</code></pre>

<p>Where the -c supplies the configuration.  Is there any way to get it to run this command based on the publishing profile the user has selected?</p>

<p>You could use an <code>ARG</code> statement in your Dockerfile.</p>

<pre><code>ARG publishingProfile
RUN dotnet publish "Aeros.Services.Kubernetes.csproj" -c $publishingProfile -o /app
</code></pre>

<p>Use it like this from the command line:<br>
<code>docker build --build-arg publishingProfile=Release</code></p>
