-
Notifications
You must be signed in to change notification settings - Fork 48
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
Unable to connect a Windows container as an ephemeral slave/agent #233
Comments
Saw following exception just now in the logs: |
You should ensure that after contain start it will be alive and cmd.exe wouldn't exit, because container will stop then and connection will fail. |
I was able to launch a Linux container as an ephemeral Jenkins agent using SSH. However, I am unable to do the same with a Windows container. I can verify that the SSHD service is running in the Windows container by running it interactively and performing an ssh @<container_ip_address>.
Only the following log information in the Jenkins Master:
May 28, 2018 2:06:54 PM INFO com.github.kostyasha.yad.DockerCloud provision
Will provision 'jenkins/windows-ssh-slave:1.0', for label: 'docker-windows-slave2', in cloud: 'YADP-windows-cloud'
May 28, 2018 2:06:54 PM INFO com.github.kostyasha.yad.DockerCloud addProvisionedSlave
Provisioning 'jenkins/windows-ssh-slave:1.0' number '0' on 'YADP-windows-cloud'; Total containers: '0'
May 28, 2018 2:07:53 PM INFO hudson.slaves.RetentionStrategy$Demand check
On the dockerhost I see following output with docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
44d92a7d90f8 jenkins/windows-ssh-slave:1.0 "cmd.exe cmd" About a minute ago Exited (0) About a minute ago vig
Dockerfile for the image -----------------------------------
FROM microsoft/windowsservercore
SHELL ["powershell.exe", "-ExecutionPolicy", "Bypass", "-Command"]
RUN iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
RUN choco install -y git --params='/NoShellIntegration'
RUN choco install -y nuget.commandline
ENV JAVA_HOME c:/jre-8u171
ENV JENKINS_HOME c:/jenkins
ENV JAVA_EXE jre-8u171-windows-x64.exe
#RUN (new-object System.Net.WebClient).Downloadfile('http://javadl.oracle.com/webapps/download/AutoDL?BundleId=233172_512cd62ec5174c3487ac17c61aaa89e8', 'C:$env:JAVA_EXE')
COPY jre-8u171-windows-x64.exe C:/
RUN start-process -filepath C:/jre-8u171-windows-x64.exe -passthru -wait -argumentlist "/s,INSTALLDIR=$env:JAVA_HOME,/L,install64.log"
RUN del C:/jre-8u171-windows-x64.exe
RUN $env:PATH = $env:JAVA_HOME + '\bin;' + $env:PATH;
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine);
RUN mkdir ~/.ssh
COPY authorized_keys C:/
RUN copy c:/authorized_keys ~/.ssh/
Download openssh for windows
COPY OpenSSH-Win64.zip C:/
COPY agent.jar C:/
RUN Expand-Archive C:/OpenSSH-Win64.zip -DestinationPath c:/
RUN C:/OpenSSH-Win64/install-sshd.ps1
RUN del C:/OpenSSH-Win64.zip
RUN mkdir $env:JENKINS_HOME
WORKDIR $JENKINS_HOME
RUN mkdir C:/data
VOLUME C:/data
EXPOSE 22
RUN net start sshd
RUN Set-Service sshd -StartupType Automatic
RUN start-service sshd
ENTRYPOINT ["cmd.exe"]
The text was updated successfully, but these errors were encountered: