Docker Community Forums

Share and learn in the Docker community.

Install vcredist in dockerfile

I will run microsoft vcredist file using dockerfile…I write command with using visual studio code.I cretaed like this file ;

FROM mcr.microsoft.com/windows/nanoserver:1809
SHELL [“powershell”]
WORKDIR /app
ARG redist1=“Microsoft Visual C++ 2008 SP1 Redistributable x64.exe”
COPY ${redist1} ./
RUN C:\app\Microsoft Visual C++ 2008 SP1 Redistributable x64.exe /quiet /install

then build dockerfile , there are some error messages on terminal.This messages display on step 6 ;

Sending build context to Docker daemon 127.4MB
Step 1/6 : FROM mcr.microsoft.com/windows/nanoserver:1809
1809: Pulling from windows/nanoserver
Digest: sha256:5e8cbdb57a33156c9f37bec01b6add720532d1432ce4ade821920c4f7b8c6409
Status: Image is up to date for mcr.microsoft.com/windows/nanoserver:1809
—> 6795354d435f
Step 2/6 : SHELL [“powershell”]
—> Running in d576b7599ec3
Removing intermediate container d576b7599ec3
—> 946e3c23efb9
Step 3/6 : WORKDIR /app
—> Running in 4f9bcf7ee8ee
Removing intermediate container 4f9bcf7ee8ee
—> af485f3cb631
Step 4/6 : ARG redist1=“Microsoft Visual C++ 2008 SP1 Redistributable x64.exe”
—> Running in 80cbae7e5cb4
Removing intermediate container 80cbae7e5cb4
—> 56b5a26319ce
Step 5/6 : COPY ${redist1} ./
—> 64f3ee18600a
Step 6/6 : RUN C:\app\Microsoft Visual C++ 2008 SP1 Redistributable x64.exe /quiet /install
—> Running in ef5130cf7ba9
container ef5130cf7ba94332c8890f82449f1c149c4bcee007aef3e7a940d49d00d954c1 encountered an error during hcsshim::System::CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2)
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(173)\vmcomputeagent.exe!00007FF6ADD79D2B: (caller: 00007FF6ADD2E13A) Exception(2) tid(378) 80070002 The system cannot find the file specified.
CallContext:[\Bridge_ProcessMessage\VmHostedContainer_ExecuteProcess]
Provider: 00000000-0000-0000-0000-000000000000] extra info: {“CommandLine”:“powershell C:\app\Microsoft Visual C++ 2008 SP1 Redistributable x64.exe /quiet /install”,“User”:“ContainerUser”,“WorkingDirectory”:“C:\app”,“Environment”:{“redist1”:“Microsoft Visual C++ 2008 SP1 Redistributable x64.exe”},“CreateStdInPipe”:true,“CreateStdOutPipe”:true,“CreateStdErrPipe”:true,“ConsoleSize”:[0,0]}
The terminal process “C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command docker build --pull --rm -f “Dockerfile\Dockerfile” -t project:latest “Dockerfile”” terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

I think something wrong when I “run” command.Can you help me how to install container in docker file ?

Thank you

Could you please provide a dockerfile how to install vcredist inside docker.

I tried different ways but no success. For example my dockerfile. It tries to install something but there are no libs and logs in the system

FROM mcr.microsoft.com/windows/servercore:ltsc2019

SHELL [“powershell”, “-Command”, "$ErrorActionPreference = ‘Stop’;

$ProgressPreference = ‘SilentlyContinue’; $verbosePreference=‘Continue’;"]

WORKDIR c:/temp

ADD http://download.microsoft.com/download/0/5/6/056dcda9-d667-4e27-8001-8a0c6971d6b1/vcredist_x64.exe c:/temp/vcredist_x64.exe

RUN Start-Process -filepath C:/temp/vcredist_x64.exe -ArgumentList “/install”, “/passive”, “/norestart”, “’/log c:/temp/a.txt’” -PassThru | wait-process