Образ докера Windows с использованием нано-сервера в качестве базового образа не может запустить удаленный агент бамбука на нано-сервере

Я создал образ докера Windows, используя нано-сервер в качестве базового образа, и установил на него SDK с точечным ядром, так как нано-сервер является облегченной операционной системой. Я также скачал и установил путь для Java, как это требуется для установки Bamboo. Цель этого образа - запустить контейнер нано-сервера, который может запустить удаленный агент бамбука и построить проекты на этом удаленном агенте. Образ, который я создал, может установить путь к Java и загрузить файл JAR-файла Bamboo Agent. Но при запуске бамбукового банка агента он говорит, что процесс агента запущен, но сразу же основной агент завершается.

Докер-файл выглядит так:

FROM microsoft/nanoserver:10.0.14393.1770
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; 
$ProgressPreference = 'SilentlyContinue';"]

# Install .NET Core SDK
ENV DOTNET_SDK_VERSION 2.0.2
ENV DOTNET_SDK_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-win-x64.zip
ENV DOTNET_SDK_DOWNLOAD_SHA 4864A36D3BE9D460A17D0EBE9D03B17CE224EC18880BCDBC087889F32DDFC2CF3753A1AB7D0414B1E73E863E0D10F5A8381E80EFFC7F7C0A50600DD82A1F0048
RUN Invoke-WebRequest $Env:DOTNET_SDK_DOWNLOAD_URL -OutFile dotnet.zip; `
if ((Get-FileHash dotnet.zip -Algorithm sha512).Hash -ne $Env:DOTNET_SDK_DOWNLOAD_SHA) { `
    Write-Host 'CHECKSUM VERIFICATION FAILED!'; `
    exit 1; `
}; `
`
Expand-Archive dotnet.zip -DestinationPath $Env:ProgramFiles\dotnet; `
Remove-Item -Force dotnet.zip

RUN setx /M PATH $($Env:PATH + ';' + $Env:ProgramFiles + '\dotnet' + ';' + $Env:ProgramFiles + '\jdk\java-1.8.0-openjdk-1.8.0.121-1.b13.ojdkbuild.windows.x86_64\bin')

# Trigger the population of the local package cache
ENV NUGET_XMLDOC_MODE skip
RUN New-Item -Type Directory warmup; `
cd warmup; `
dotnet new; `
cd ..; `
Remove-Item -Force -Recurse warmup

RUN Invoke-WebRequest https://github.com/ojdkbuild/ojdkbuild/releases/download/1.8.0.121-1/java-1.8.0-openjdk-1.8.0.121-1.b13.ojdkbuild.windows.x86_64.zip -OutFile jdk.zip
RUN Expand-Archive jdk.zip -DestinationPath $Env:ProgramFiles\jdk
#RUN Move-Item $Env:Program Files\jdk\java* $Env:Program Files\jdk

RUN Invoke-WebRequest http://10.16.86.137:8085/agentServer/agentInstaller/atlassian-bamboo-agent-installer-6.1.1.jar -OutFile bamboo-agent.jar


RUN echo 'java -jar C:\bamboo-agent.jar http://10.16.86.137:8085/agentServer/' >> C:\startup.ps1

CMD powershell ./startup.ps1

Я попробовал то же самое, используя nanoserver/java в качестве базового образа, и получил тот же результат.

Логи консоли выглядят так

PS C:\> java -jar bamboo-agent.jar http://10.16.86.137:8085/agentServer/
Reinstalling wrapper binaries, reason: agent either not installed or outdated
Unzipping /classpath.zip to C:\Users\ContainerAdministrator\bamboo-agent home\classpath
Extracting 'MANIFEST.DAT'
Extracting 'atlassian-extras-decoder-api-3.3.0.jar'
Extracting 'atlassian-cache-ehcache-2.11.3.jar'
Extracting 'atlassian-annotations-1.1.0.jar'
Extracting 'truezip-kernel-7.6.jar'
Extracting 'activemq-client-5.14.5.jar'
Extracting 'atlassian-bamboo-core-6.2.1.jar'
Extracting 'svnkit-1.8.15.jar'
Extracting 'maven-model-3.0.5.jar'
Extracting 'commons-codec-1.8.jar'
Extracting 'commons-pool2-2.4.2.jar'
Extracting 'beehive-api-0.2.1.jar'
Extracting 'api-1.6.0-atlassian-8.jar'
Extracting 'geronimo-jms_1.1_spec-1.1.1.jar'
Extracting 'atlassian-bamboo-plugin-dotnet-6.1.1.jar'
Extracting 'atlassian-bandana-3.1.jar'
Extracting 'activemq-pool-5.14.5.jar'
Extracting 'maven-settings-builder-3.0.5.jar'
Extracting 'atlassian-plugins-webresource-3.3.7.jar'
Extracting 'applinks-api-5.4.1.jar'
Extracting 'xpp3_min-1.1.4c.jar'
Extracting 'atlassian-plugins-spring-4.1.0.jar'
Extracting 'activemq-broker-5.14.5.jar'
Extracting 'atlassian-plugins-webresource-api-3.3.7.jar'
Extracting 'atlassian-bamboo-agent-elastic-shared-6.2.1.jar'
Extracting 'atlassian-bamboo-agent-elastic-6.2.1.jar'
Extracting 'atlassian-bamboo-utils-6.2.1.jar'
Extracting 'atlassian-localhost-1.1.0.jar'
Extracting 'atlassian-secure-random-3.2.4.jar'
Extracting 'atlassian-extras-common-3.3.0.jar'
Extracting 'atlassian-cookie-tools-3.2.3.jar'
Extracting 'spring-messaging-4.3.6.RELEASE.jar'
Extracting 'jta-1.0.1B.jar'
Extracting 'maven-embedder-3.0.5.jar'
Extracting 'atlassian-user-core-5.4.6.jar'
Extracting 'atlassian-velocity-0.5.jar'
Extracting 'stringtemplate-3.2.1.jar'
Extracting 'bcprov-jdk15on-1.54.jar'
Extracting 'maven-repository-metadata-3.0.5.jar'
Extracting 'atlassian-xwork-12-2.5.10-struts-2.jar'
Extracting 'plexus-classworlds-2.4.jar'
Extracting 'sal-spring-3.0.8.jar'
Extracting 'atlassian-bamboo-api-6.2.1.jar'
Extracting 'atlassian-scheduler-quartz2-1.6.0.jar'
Extracting 'bamboo-specs-api-6.2.1.jar'
Extracting 'atlassian-mail-2.7.19.jar'
Extracting 'spring-beans-4.3.6.RELEASE.jar'
Extracting 'atlassian-bamboo-maven-embedder-6.2.1.jar'
Extracting 'ion-java-1.0.2.jar'
Extracting 'maven-settings-3.0.5.jar'
Extracting 'atlassian-bamboo-plugin-scripttask-6.2.1.jar'
Extracting 'maven-core-3.0.5.jar'
Extracting 'atlassian-secure-xml-3.2.4.jar'
Extracting 'oro-2.0.8.jar'
Extracting 'applinks-host-5.4.1.jar'
Extracting 'commons-lang-2.6.jar'
Extracting 'bamboo-additional-config.jar'
Extracting 'maven-compat-3.0.5.jar'
Extracting 'javax.mail-1.5.2.jar'
Extracting 'atlassian-bucket-5.1.3.jar'
Extracting 'soy-template-renderer-plugin-api-4.0.4.jar'
Extracting 'freemarker-2.3.24-atlassian-2.jar'
Extracting 'atlassian-plugins-servlet-4.1.0.jar'
Extracting 'jna-4.1.0.jar'
Extracting 'spring-core-4.3.6.RELEASE.jar'
 Extracting 'atlassian-bamboo-plugin-triggercondition-6.2.1.jar'
Extracting 'jsch.agentproxy.pageant-0.0.7.jar'
Extracting 'jackson-annotations-2.7.9.jar'
Extracting 'jboss-logging-3.3.0.Final.jar'
Extracting 'aws-java-sdk-s3-1.11.164.jar'
Extracting 'spring-context-4.3.6.RELEASE.jar'
Extracting 'xercesImpl-2.11.0.jar'
Extracting 'spring-orm-4.3.6.RELEASE.jar'
Extracting 'package-scanner-0.9.5.jar'
Extracting 'atlassian-util-concurrent-4.0.0.jar'
Extracting 'quartz-2.2.3.jar'
Extracting 'aether-impl-1.13.1.jar'
Extracting 'jansi-1.11.jar'
Extracting 'security-classlist-api-0.3.21.jar'
Extracting 'platform-3.4.0.jar'
Extracting 'atlassian-cache-api-2.11.3.jar'
Extracting 'commons-digester-1.8.jar'
Extracting 'sequence-library-1.0.3.jar'
Extracting 'javacvs-atlassian-20080407.jar'
Extracting 'aspectjrt-1.8.9.jar'
Extracting 'atlassian-instrumentation-core-2.2.1.jar'
Extracting 'atlassian-scheduler-core-1.6.0.jar'
Extracting 'commons-validator-1.5.1.jar'
Extracting 'atlassian-plugins-osgi-events-4.1.0.jar'
Extracting 'jaxen-1.1.6.jar'
Extracting 'atlassian-bamboo-plugin-stashcommitviewer-6.2.1.jar'
Extracting 'atlassian-bamboo-agent-elastic-server-6.2.1.jar'
Extracting 'c3p0-0.9.5.2.jar'
Extracting 'atlassian-ip-3.1.jar'
Extracting 'slf4j-api-1.7.10.jar'
Extracting 'atlassian-aws-1.0.149.jar'
Extracting 'jsch.agentproxy.core-0.0.7.jar'
Extracting 'staxmate-2.0.0.jar'
Extracting 'commons-beanutils-1.9.2.jar'
Extracting 'activemq-jms-pool-5.14.5.jar'
Extracting 'aws-java-sdk-kms-1.11.164.jar'
Extracting 'p4java-0.7.5-atlassian-13.jar'
Extracting 'atlassian-johnson-1.0.jar'
Extracting 'mchange-commons-java-0.2.11.jar'
Extracting 'atlassian-tenancy-api-2.0.0.jar'
Extracting 'aws-java-sdk-codedeploy-1.11.164.jar'
Extracting 'atlassian-bamboo-plugin-ant-6.2.1.jar'
Extracting 'bamboo-specs-6.2.1.jar'
Extracting 'xmlpull-1.1.3.1.jar'
Extracting 'minlog-1.3.0.jar'
Extracting 'ehcache-2.7.5.jar'
Extracting 'acegi-security-1.0.4.jar'
Extracting 'activeobjects-spi-1.2.3.jar'
Extracting 'jaxb-api-2.1.jar'
Extracting 'osuser-1.0-20060106.jar'
Extracting 'geronimo-j2ee-connector_1.5_spec-2.0.0.jar'
Extracting 'atlassian-extras-core-3.3.0.jar'
Extracting 'atlassian-extras-legacy-3.3.0.jar'
Extracting 'jackson-dataformat-cbor-2.7.9.jar'
Extracting 'atlassian-plugins-osgi-4.1.0.jar'
Extracting 'geronimo-transaction-3.1.jar'
Extracting 'jackson-core-2.7.9.jar'
Extracting 'maven-artifact-3.0.5.jar'
Extracting 'truezip-driver-zip-7.6.jar'
Extracting 'truezip-swing-7.6.jar'
Extracting 'joda-time-2.8.2.jar'
Extracting 'httpcore-4.4.6.jar'
Extracting 'sqljet-1.1.10.jar'
Extracting 'jandex-2.0.3.Final.jar'
Extracting 'applinks-spi-5.4.1.jar'
Extracting 'jackson-core-asl-1.9.1.jar'
Extracting 'hibernate-jpa-2.1-api-1.0.0.Final.jar'
Extracting 'atlassian-bamboo-plugin-php-6.2.1.jar'
Extracting 'lucene-analyzers-common-4.6.0.jar'
Extracting 'ant-1.8.4.jar'
Extracting 'activemq-protobuf-1.1.jar'
Extracting 'aopalliance-1.0.jar'
Extracting 'hibernate-ehcache-5.2.10.Final.jar'
Extracting 'spring-context-support-4.3.6.RELEASE.jar'
Extracting 'atlassian-plugins-webfragment-4.0.0.jar'
Extracting 'atlassian-bamboo-web-6.2.1.jar'
Extracting 'truezip-file-7.6.jar'
Extracting 'antlr-2.7.7.jar'
Extracting 'trilead-ssh2-1.0.0-build221.jar'
Extracting 'asm-5.0.3.jar'
Extracting 'atlassian-bamboo-deployments-6.2.1.jar'
Extracting 'slf4j-log4j12-1.7.10.jar'
Extracting 'commons-collections4-4.1.jar'
Extracting 'wagon-http-shared4-2.4.jar'
Extracting 'commons-httpclient-3.1-atlassian-2.jar'
Extracting 'lucene-core-4.6.0.jar'
Extracting 'geronimo-j2ee-connector_1.6_spec-1.0.jar'
Extracting 'atlassian-extras-api-3.3.0.jar'
Extracting 'maven-plugin-api-3.0.5.jar'
Extracting 'aether-spi-1.13.1.jar'
Extracting 'atlassian-plugins-api-4.1.0.jar'
Extracting 'fugue-2.2.1.jar'
Extracting 'atlassian-plugins-webresource-common-4.1.0.jar'
Extracting 'webwork-compat-1.32.jar'
Extracting 'jxmpp-util-cache-0.4.2.jar'
Extracting 'maven-model-builder-3.0.5.jar'
Extracting 'atlassian-html-encoder-1.5.jar'
Extracting 'atlassian-bamboo-plugin-labeller-6.2.1.jar'
Extracting 'atlassian-plugins-webfragment-api-4.0.0.jar'
Extracting 'hawtbuf-1.11.jar'
Extracting 'atlassian-processutils-1.7.9.jar'
Extracting 'jul-to-slf4j-1.7.10.jar'
Extracting 'jdom-1.0.jar'
Extracting 'sourcemap-1.7.2.jar'
Extracting 'jsr305-1.1.jar'
Extracting 'commons-io-2.4.jar'
Extracting 'ant-launcher-1.8.4.jar'
Extracting 'objenesis-2.4.jar'
Extracting 'atlassian-bamboo-plugin-fisheyecommitviewer-6.2.1.jar'
Installing file: C:\Users\ContainerAdministrator\bamboo-agent-home\conf\wrapper.conf
Installing file: /generic/lib/wrapper.jar to: C:\Users\ContainerAdministrator\bamboo-agent-home\lib\wrapper.jar
Installing file: /generic/lib/bamboo-agent-bootstrap-jar-with-dependencies.jar to: C:\Users\ContainerAdministrator\bamboo-agent-home\lib\bamboo-agent-bootstrap.jar
Installing file: /generic/bin/BambooAgent.bat to:C:\Users\ContainerAdministrator\bamboo-agent-home\bin\BambooAgent.bat
Installing file: /generic/bin/InstallBambooAgent-NT.bat to: C:\Users\ContainerAdministrator\bamboo-agent-home\bin\InstallBambooAgent-NT.bat
Installing file: /generic/bin/StartBambooAgent-NT.bat to: C:\Users\ContainerAdministrator\bamboo-agent-home\bin\StartBambooAgent-NT.bat
Installing file: /generic/bin/StopBambooAgent-NT.bat to:C:\Users\ContainerAdministrator\bamboo-agent-home\bin\StopBambooAgent-NT.bat
Installing file: /generic/bin/UninstallBambooAgent-NT.bat to:C:\Users\ContainerAdministrator\bamboo-agent-home\bin\UninstallBambooAgent-NT.bat
Installing file: /arch/windows/64/wrapper.exe to:C:\Users\ContainerAdministrator\bamboo-agent-home\bin\wrapper.exe    
Installing file: /arch/windows/64/wrapper.dll to:C:\Users\ContainerAdministrator\bamboo-agent-home\lib\wrapper.dll
LOCALAPPDATA: C:\Users\ContainerAdministrator\AppData\Local
PROCESSOR_LEVEL: 6
USERDOMAIN: User Manager
ALLUSERSPROFILE: C:\ProgramData
PROCESSOR_ARCHITECTURE: AMD64
SystemDrive: C:
DOTNET_SDK_VERSION: 2.0.2
APPDATA: C:\Users\ContainerAdministrator\AppData\Roaming
BAMBOO_SERVER: http://10.16.86.137:8085/agentServer/
USERNAME: ContainerAdministrator
ProgramFiles(x86): C:\Program Files (x86)
CommonProgramFiles: C:\Program Files\Common Files
NUGET_XMLDOC_MODE: skip
Path:C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\
System32\WindowsPowerShell\v1.0\;C:\Users\ContainerAdministrator\AppData\
Local\Microsoft\WindowsApps;C:\Program Files\dotnet;C:\Program Files\jdk\
java-1.8.0-openjdk-1.8.0.121-1.b13.ojdkbuild.windows.x86_64\bin;
PATHEXT: .COM;.EXE;.BAT;.CMD
OS: Windows_NT
COMPUTERNAME: BB7F1D575456
BAMBOO_AGENT_HOME: "C:\Users\ContainerAdministrator\bamboo-agent-home"
PROCESSOR_REVISION: 3c03
CommonProgramW6432: C:\Program Files\Common Files
NUGET_XMLDOC_MODE: skip 
Path:C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\
System32\WindowsPowerShell\v1.0\;C:\Users\ContainerAdministrator\AppData\
Local\Microsoft\WindowsApps;C:\Program Files\dotnet;C:\Program 
Files\jdk\java-1.8.0-openjdk-1.8.0.121-1.b13.ojdkbuild.windows.x86_64\bin;
PATHEXT: .COM;.EXE;.BAT;.CMD
OS: Windows_NT
COMPUTERNAME: BB7F1D575456
BAMBOO_AGENT_HOME: "C:\Users\ContainerAdministrator\bamboo-agent-home"
PROCESSOR_REVISION: 3c03
CommonProgramW6432: C:\Program Files\Common Files
ComSpec: C:\Windows\system32\cmd.exe
ProgramData: C:\ProgramData
ProgramW6432: C:\Program Files
IGNORE_SERVER_CERT_NAME: false
SystemRoot: C:\Windows
TEMP: C:\Users\ContainerAdministrator\AppData\Local\Temp
PROCESSOR_IDENTIFIER: Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
USERPROFILE: C:\Users\ContainerAdministrator
TMP: C:\Users\ContainerAdministrator\AppData\Local\Temp
DOTNET_SDK_DOWNLOAD_URL:https://dotnetcli.blob.core.windows.net/dotnet/Sdk/
2.0.2/dotnet-sdk-2.0.2-win-x64.zip
CommonProgramFiles(x86): C:\Program Files (x86)\Common Files
ProgramFiles: C:\Program Files
PUBLIC: C:\Users\Public
BAMBOO_SECURITY_TOKEN:
DOTNET_SDK_DOWNLOAD_SHA: 864A36D3BE9D460A17D0EBE9D03B17CE224EC18880BCDBC087889F32DDFC2CF3753A1AB7D0414B1E3E863E0D10F5A8381E80EFFC7F7C0A50600DD82A1F0048
NUMBER_OF_PROCESSORS: 4
windir: C:\Windows
Running [C:\Users\ContainerAdministrator\bamboo-agent-home\bin\BambooAgent.bat]
Agent process started, shutdown hook registered, proceeding with log pump...
Waiting for the agent process to finish...
Underlying agent process has terminated cleanly,
Bamboo Agent Installer is shutting down, the underlying agent process has already been shut down.

Спасибо!

1 ответ

Команда java -jar bamboo-agent.jar http://10.16.86.137:8085/agentServer/ выполняется командой RUN, которая будет выполняться при построении образа.

Когда вы создаете образ, такие команды, как RUN, выполняются и создают слой, а затем завершаются. Это то, что представляет собой сборка изображений, создавая кучу слоев FS, которые впоследствии будут использоваться при запуске контейнера. Если вам нужно запустить агент, вам нужно запустить его при запуске контейнера, и это делается с помощью команды CMD. Наивный способ реорганизовать ваш Dockerfile - это объединить последние RUN и CMD следующим образом:

CMD echo 'java -jar C:\bamboo-agent.jar http://10.16.86.137:8085/agentServer/' >> C:\startup.ps1 && powershell ./startup.ps1
Другие вопросы по тегам