Docker Community Forums

Share and learn in the Docker community.

LibreOffice headless on Windows Server Core not acepting connections

(Gabriel Muñoz) #1

Expected behavior

Having LibreOffice running in headless mode on Windows Server Core, be able to connect to that “service” from other containers in the same composition or even from the same container (Test-NetConnection -ComputerName localhost -Port 8101)

Actual behavior

Error connection to LibreOffice headless from other containers in the same composition and from the same container with the Powershell command Test-NetConnection.


This is the Dockerfile used to generate the Headless Libreoffice Docker image
FROM microsoft/windowsservercore
MAINTAINER Gabriel Munoz
LABEL Description=“LibreOffice” Vendor=“The Document Foundation” Version=“5.4.2”


RUN mkdir C:\LibreOffice
WORKDIR /LibreOffice

RUN powershell -Command
$ErrorActionPreference = ‘Stop’; \
Invoke-WebRequest -Method Get -Uri %LIBREOFFICE_URL% -OutFile c:\LibreOffice.msi ;
Start-Process c:\LibreOffice.msi -ArgumentList ‘/qr /msoreg=0 ADDLOCAL=ALL CREATEDESKTOPLINKE=0 REGISTER_ALL_SMO_TYPES=1 REGISTER_DOC=1 INSTALLLOCATION=c:\LibreOffice REMOVE=gm_o_Onlineupdate,gm_p_Base,gm_p_Base_Bin,gm_o_Xsltfiltersamples RebootYesNo=No’ -Wait ; \
Remove-Item c:\LibreOffice.msi -Force


CMD “C:\LibreOffice\program\soffice.exe --headless --accept=‘socket,host=,port=8101;urp;’ --nofirststartwizard”

Steps to reproduce the behavior

  1. Generate the docker image using the provided Dockerfile
  2. Run a container based on that image
  3. Enter into the container (docker exec -t -i powershell)
  4. See with the ps command that LibreOffice is running
  5. Execute Test-NetConnection -ComputerName localhost -Port 8101
  6. The command fails to connect using that port
  7. You also get the same error using Test-NetConnection from other container in the same docker-compose file.

(Gabriel Muñoz) #2

I answer myself. The quotes in C:\LibreOffice\program\soffice.exe --headless --accept=‘socket,host=,port=8101;urp;’ --nofirststartwizard need to be replaced by double quotes:
C:\LibreOffice\program\soffice.exe --headless --accept=“socket,host=,port=8101;urp;” --nofirststartwizard
and it works. I don’t know the reason.