I’m trying to build a pipeline in jenkins using a node but everytime my pipeline keeps getting stuck on :
[Pipeline] Start of Pipeline
[Pipeline] properties
[Pipeline] node
Still waiting to schedule task
Waiting for next available executor
and this is the node error in jenkins :
java.io.IOException: Container is not running.
here’s the scripts :
node dockerfile :
# syntax=docker/dockerfile:1
# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Dockerfile reference guide at
# https://docs.docker.com/go/dockerfile-reference/
ARG PYTHON_VERSION=3.11
FROM python:${PYTHON_VERSION}-slim as base
# Prevents Python from writing pyc files.
ARG env
ENV ENV $env
# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1
# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1
# Set PYTHONPATH in environment variable
ENV PYTHONPATH="/app/src"
WORKDIR /app
# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/go/dockerfile-user-best-practices/
ARG UID=10001
RUN adduser
--disabled-password
--gecos ""
--home "/home/appuser"
--shell "/sbin/nologin"
--no-create-home
--uid "${UID}"
appuser
RUN mkdir -p /home/appuser
RUN chmod 700 /home/appuser
RUN chown appuser /home/appuser
RUN mkdir -p /app/output
RUN chmod 700 /app/output
RUN chown appuser /app/output
COPY ../entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod 777 /usr/local/bin/entrypoint.sh
#RUN ln -s /usr/local/bin/entrypoint.sh
# Install Python dependencies
COPY ./requirements.txt /tmp/requirements.txt
RUN python -m pip install -r /tmp/requirements.txt
# Switch to the non-privileged user to run the application.
USER appuser
# Copy the source code into the container.
COPY ../src /app/src
COPY ../src/configuration/$ENV /app/src/config.lnk
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["bash"]
jenkinsfile :
def call(Closure body) {
def config = [:]
body.resolveStrategy = Closure.DELEGATE_FIRST
body.delegate = config
body()
node("image") {
stage('Checkout') {
echo "Checking out code"
checkout scm
}
post {
success {
echo "Code checked out successfully"
}
failure {
echo "Failed to checkout code"
}
}
Locally :
I can run the image with --entrypoint /bin/bash
like :
docker run -it –entrypoint bash
entrypoint.sh is empty.