I\'m using a Jenkins declarative pipeline with Docker Agents to build and test my software, including running integration tests using testcontainers. I can run my testcontai
In my case it was enough to add two arguments to Docker agent options:
--group-add parameter with ID of docker grouppipeline {
agent any
stages {
stage('Gradle build') {
agent {
docker {
reuseNode true
image 'openjdk:11.0-jdk-slim'
args '-v /var/run/docker.sock:/var/run/docker.sock --group-add 992'
}
}
steps {
sh 'env | sort'
sh './gradlew build --no-daemon --stacktrace'
}
}
} // stages
} // pipeline