4

I am trying to get Microsoft Excel working from within a Docker Windows container. The purpose of this container is to run an Excel workbook with VBA code that essentially runs a batch process. However, I have been unable to get Excel successfully installed in the container.

To install Excel in a controlled manner, I have resorted to the following partially manual process:

  1. Build a Docker image with the following Dockerfile:
FROM mcr.microsoft.com/windows/servercore:ltsc2019 AS build 
WORKDIR C:\\odtsetup 
COPY odtsetup.exe C:\\odtsetup
RUN odtsetup.exe /quiet /norestart /extract:C:\\odtsetup
  1. Run the image interactively with:
docker run -it IMAGE cmd
  1. Manually execute the following Office Deployment Tool steps from a command prompt within the container:
setup.exe /download C:\\odtsetup\\configuration.xml
setup.exe /configure C:\\odtsetup\\configuration.xml

Here is the configuration.xml file:

<Configuration>
  <Add OfficeClientEdition="64" Channel="PerpetualVL2019">
    <Product ID="ProPlus2019Volume">
      <Language ID="en-us" />
    </Product>
  </Add>
  <Display Level="None" AcceptEULA="TRUE" />
  <Property Name="AUTOACTIVATE" Value="1"/>
  <Logging Level="Standard" Path="c:\logs" />
</Configuration>

The steps appear to run successfully to completion. However, Excel will not launch, and the ODT installation log for the ODT configure step reveals the following error:

|"C2R client returned failing error code","error code":"17002"

Also, inspecting the Registry reveals that numerous entries are missing. For example, the following command from Powershell does not return any results:

Get-ChildItem HKLM:\Software\Classes | Select-Object -ExpandProperty PSChildName | where-Object {$_ -eq 'Excel.Application'}

While searching the Web, I have seen other 17002 issues when trying to run MS Office apps in a container. I have not seen any solutions.

If I perform the exact same ODT installation steps on Windows 2019 Datacenter v1809, Excel installs without issue.

What is causing the 17002 error and how do I avoid this error and successfully install Excel in a Docker Windows container?

Jeremy
  • 2,870
  • 3
  • 23
  • 31
crosen9999
  • 823
  • 7
  • 13
  • 1
    `In this case, the command did appear to complete and excel.exe appeared in the tasklist. However, the VBA code never executed` I have never worked with Win Docker but these 3 questions come to my mind. **1.** Did the workbook open?` **2.** Macros are enabled? Manually open file in docker and check (File - Options) **3.** Does file needs unblocking? File - Right click properties... – Siddharth Rout Sep 21 '20 at 06:33
  • Any update? i face the same issue – Amit Baranes Oct 07 '20 at 13:28
  • We actually decided that containerizing our existing application was going to be an uphill battle at many steps along the way and so decided to go in a different direction. – crosen9999 Oct 07 '20 at 14:32
  • That makes sense, thank you! – Amit Baranes Oct 11 '20 at 10:27
  • I believe is not going to work because the Windows Container images (including the "full API" one) are missing components for Office: https://learn.microsoft.com/en-us/dotnet/architecture/modernize-with-azure-containers/modernize-existing-apps-to-cloud-optimized/when-not-to-deploy-to-windows-containers – Erick B Nov 09 '21 at 18:19

0 Answers0