Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSI installer doesn't seem to work inside a Docker build. #9010

Open
jghal opened this issue Oct 24, 2024 · 0 comments
Open

MSI installer doesn't seem to work inside a Docker build. #9010

jghal opened this issue Oct 24, 2024 · 0 comments

Comments

@jghal
Copy link

jghal commented Oct 24, 2024

I'm trying to build a custom image with the CLI installed and there is an issue with installing the MSI. My Docker host is on Windows Server 2019.

FROM mcr.microsoft.com/dotnet/framework/sdk:4.8

SHELL ["powershell", "-Command", "Continue = 'Stop'; SilentlyContinue = 'SilentlyContinue';"]

RUN Invoke-WebRequest -Uri "https://awscli.amazonaws.com/AWSCLIV2.msi" -OutFile "AWSCLIV2.msi" -UseBasicParsing ; \
    Start-Process -Wait msiexec.exe -ArgumentList @('/i', 'AWSCLIV2.msi', '/qn', '/L*v', 'C:\\install.log') ; \
    Remove-Item -Force AWSCLIV2.msi

ENTRYPOINT ["signtool.exe"]

I think it's not really waiting for the install to complete. The build output looks ok

docker build -t code-sign:initial .
Sending build context to Docker daemon  45.62MB
Step 1/4 : FROM mcr.microsoft.com/dotnet/framework/sdk:4.8
 ---> bec6ad7833f7
Step 2/4 : SHELL ["powershell", "-Command", "Continue = 'Stop'; SilentlyContinue = 'SilentlyContinue';"]
 ---> Using cache
 ---> 54084da07108
Step 3/4 : RUN Invoke-WebRequest -Uri "https://awscli.amazonaws.com/AWSCLIV2.msi" -OutFile "AWSCLIV2.msi" -UseBasicParsing ;     Start-Process -Wait msiexec.
exe -ArgumentList @('/i', 'AWSCLIV2.msi', '/qn', '/L*v', 'C:\\install.log') ;     Remove-Item -Force AWSCLIV2.msi
 ---> Using cache
 ---> 5dc86b4aa385
Step 4/4 : ENTRYPOINT ["signtool.exe"]
 ---> Using cache
 ---> 85355ccfad6e
Successfully built 85355ccfad6e
Successfully tagged code-sign:initial

But the resulting image doesn't seem to have the CLI installed, or the log file from the installer

PS C:\> docker run --rm -it --entrypoint powershell code-sign:initial
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\> dir C:\

    Directory: C:\

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-r---        10/8/2024   5:57 PM                Program Files
d-----        10/8/2024   6:03 PM                Program Files (x86)
d-r---        10/4/2024   9:52 PM                Users
d-----        10/8/2024   5:49 PM                Windows
-a----         9/6/2024   1:02 AM           5647 License.txt

PS C:\> dir 'C:\Program Files\'

    Directory: C:\Program Files

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        9/15/2018   7:21 AM                common files
d-----        10/8/2024   5:57 PM                dotnet
d-----        10/8/2024   5:57 PM                IIS
d-----        9/15/2018   7:12 AM                internet explorer
d-----        10/8/2024   5:55 PM                NuGet
d-----        9/15/2018   7:12 AM                WindowsPowerShell

But if I run the same commands from the dockerfile to manually download and run the MSI installer inside a container and wait a few minutes then it works.

Originally posted by @jghal in #9000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant