Cannot install distributive via COPY + RUN combination

I’m running windows containers docker.
I’m trying to create a aspnet build/publish machine and I want to install the Net FX tools that are required for that.

Simple Docker file for test:

FROM microsoft/aspnet
WORKDIR /build
COPY ./Distr/NDP461-DevPack-KB3105179-ENU.exe 'C:\'
RUN & ‘C:\NDP461-DevPack-KB3105179-ENU.exe’ /q /norestart

And running

docker build --no-cache=true -t buildtestimage .
docker run -d -h buildtest --name buildtest buildtestimage

The file is correctly copied. There’s no output from RUN (no errors).
However the install doesn’t create needed files and folders (Microsoft SDK) - like it did nothing.
More over, running it manually (trough docker exec) doesn’t do anything either.

BUT! If I remove the COPY + RUN instructions from Dockerfile and basically do the same steps through docker cp and docker exec - everything is working. (Code below. buildtest - name of container)

docker stop buildtest
docker cp ‘C:\Projects\Test\Distr\NDP461-DevPack-KB3105179-ENU.exe’ buildtest:C:\
docker start buildtest
docker exec -ti buildtest ‘C:\NDP461-DevPack-KB3105179-ENU.exe’ /q /norestart

Why? I mean, there’s somekind of lock on that installation file after it’s copied through dockerfile COPY instruction. I’d like to know, why it doesn’t work and if there are any workarounds?

tl;dr: How to install distributive from host into image during docker build ? COPY + RUN didn’t work.

The Windows .exe. and .msi installation system is poorly thought out and doesn’t handle command line invocation well.

Here are some examples of working around the limitations:

1 Like

The workaround

Start-Process -Wait -FilePath ‘C:\NDP461-DevPack-KB3105179-ENU.exe’ -ArgumentList ‘/q’, ‘/norestart’

totally worked for me. Many thanks - saved me :slight_smile:

I wonder, are there any works to simplify different tools install on windows containers ?
Linux containers have their apt-get - it’s really convenient.

Some people use chocolatey:

I prefer doing it from scratch, though