I have jenkins installed and a docker added as cloud. I did the docker image for the agent on docker, that's its code
FROM ubuntu:latest
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
curl \
apt-utils \
openssh-server
RUN curl -fsSL https://get.docker.com | sh
RUN apt-get install -y openjdk-11-jdk ca-certificates-java && \
apt-get clean && \
update-ca-certificates -f
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64/
RUN export JAVA_HOME
RUN useradd -rm -d /home/pawel -s /bin/bash -g root -G sudo -u 1000 pawel
RUN mkdir /var/run/sshd
RUN echo 'pawel:pawel' | chpasswd
RUN echo "ClientAliveInterval 1200" >> /etc/ssh/sshd_config
RUN echo "ClientAliveCountMax 3" >> /etc/ssh/sshd_config
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
EXPOSE 22
RUN service ssh start
CMD ["/usr/sbin/sshd", "-D", "-o", "ListenAddress=0.0.0.0"]
The problem is that when I run it locally, everything works fine for me, i.e. ssh starts because I can connect, unfortunately when I want to deploy from my image I get an error
java.io.IOException: SSH service hadn't started after 20 seconds and 68 milliseconds.Try increasing the number of retries (currently null) and/or the retry wait time (currently null) to allow for containers taking longer to start. at io.jenkins.docker.connector.DockerComputerSSHConnector.createLauncher(DockerComputerSSHConnector.java:320) at io.jenkins.docker.connector.DockerComputerConnector.createLauncher(DockerComputerConnector.java:176) at com.nirima.jenkins.plugins.docker.DockerTemplate.doProvisionNode(DockerTemplate.java:740) at com.nirima.jenkins.plugins.docker.DockerTemplate.provisionNode(DockerTemplate.java:677) at com.nirima.jenkins.plugins.docker.DockerCloud$1.run(DockerCloud.java:376) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) Blockquote
On console output I got
‘Jenkins’ doesn’t have label ‘agent-docker-web’
But I have agent with this label
Any idea what I did wrong? :(