No encontré ninguna imagen acoplable de Elasticsearch para Windows. Traté de construir mi propia imagen jdk11 y un elasticsearch 7.1.1 encima de eso. El problema es que en elasticsearch 7.1.1, JAVA_HOME está configurado en elasticsearch.bat, por lo que anula JAVA_HOME de la imagen jdk.
Mi jdk11 Dockerfile se ve así:
FROM mcr.microsoft.com/powershell:nanoserver SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop';"] COPY /jdk-11.0.3_windows-x64_bin.zip jdk.zip ENV JAVA_HOME=C:\\jdk-11 \ PATH=C:\\jdk-11\\bin;C:\\windows\\system32${PATH} RUN Expand-Archive -Path c:/jdk.zip -DestinationPath c:/ ;\ Remove-Item c:/jdk.zip -ForceMi dockerfile de elasticsearch 7.1.1 se ve así:
FROM jdk11:forelastic SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop';"] COPY /elasticsearch-7.1.1-windows-x86_64.zip c:\\elasticsearch.zip RUN Expand-Archive -Path c:/elasticsearch.zip -DestinationPath c:/ ;\ Rename-Item c:/elasticsearch-7.1.1 c:/elasticsearch ;\ Remove-Item c:/elasticsearch.zip -Force ;\ New-Item -Path c:/temp -ItemType "directory" SHELL ["cmd", "/S", "/C"] ENV ES_PATH_CONF='c:\\\\elasticsearch\\\\config' RUN del c:\elasticsearch\config /F /S /Q WORKDIR c:/elasticsearch/bin CMD ["cmd", "/C","elasticsearch.bat"]Las imágenes se construyen. Cuando intento ejecutar el contenedor de búsqueda elástica, aparece este mensaje:
"no se pudo encontrar java en JAVA_HOME o incluido en C:\elasticsearch\jdk"
Eché un vistazo más de cerca a elasticsearc 7.1.1 elasticsearch.bat y al final encontré estos comandos:
%JAVA% %ES_JAVA_OPTS% -Delasticsearch -Des.path.home="%ES_HOME%" -Des.path.conf="%ES_PATH_CONF%" -Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" -Des.distribution.type="%ES_DISTRIBUTION_TYPE%" -Des.bundled_jd="%ES_BUNDLED_JDK%" -cp "%ES_CLASSPATH%" "org.elasticsearch.bootstrap.Elasticsearch" !newparams!¿Debería construir la imagen de elasticsearch con un elasticsearch.bat modificado o hay una forma más elegante de hacerlo?
PD: los estoy ejecutando en Windows 10 (1809). Las distribuciones anteriores de Windows 10 no lo admitían , pero se solucionó con correcciones en los enlaces simbólicos.