jenkinsci / jenkinsci/docker-workflow-plugin
[JENKINS-51410] Error stopping mongod service inside Docker container
- Dominant language
- Java
- Stars
- 527
- Forks
- 422
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Description
I have a Docker image with MongoDB installed. My pipeline tries to start the mongod service, run some database commands, and then stop the mongod service. When trying to stop the mongod service, the pipeline hangs for 5 minutes and then returns a failed exit status.
I've confirmed that I'm able to run these same commands within a Docker container manually, on the same machine, with no issues, so this seems like a Jenkins issue of some sort.
To reproduce:
Create an image using the following Dockerfile:
FROM amazonlinuxENV MONGO_VERSION=3.6
RUN echo -e "[mongodb-org-${MONGO_VERSION}]\nname=MongoDB\nbaseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/${MONGO_VERSION}/x86_64/\nenabled=1\ngpgcheck=1\ngpgkey=https://www.mongodb.org/static/pgp/server-${MONGO_VERSION}.asc\n" > /etc/yum.repos.d/mongodb.repo \
&& yum groupinstall -y "Development Tools" \
&& yum install -y mongodb-orgCMD ["/bin/bash"]
Run the following pipeline on a Jenkins slave running Amazon Linux:
pipeline {
agent {
docker {
image 'your-mongo-image'
args '-u root'
}
}
stages {
stage('Test') {
steps {
sh 'service mongod start'
sh 'service mongod stop' // This is the step that hangs for 5 minutes before returning a non-zero exit status
}
}
}
}
---
Originally reported by areifert, imported from: Error stopping mongod service inside Docker container
Raw content of original issue
I have a Docker image with MongoDB installed. My pipeline tries to start the mongod service, run some database commands, and then stop the mongod service. When trying to stop the mongod service, the pipeline hangs for 5 minutes and then returns a failed exit status.
I've confirmed that I'm able to run these same commands within a Docker container manually, on the same machine, with no issues, so this seems like a Jenkins issue of some sort.
To reproduce:
Create an image using the following Dockerfile:
FROM amazonlinuxENV MONGO_VERSION=3.6
RUN echo -e "[mongodb-org-${MONGO_VERSION}]\nname=MongoDB\nbaseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/${MONGO_VERSION}/x86_64/\nenabled=1\ngpgcheck=1\ngpgkey=https://www.mongodb.org/static/pgp/server-${MONGO_VERSION}.asc\n" > /etc/yum.repos.d/mongodb.repo \
&& yum groupinstall -y "Development Tools" \
&& yum install -y mongodb-orgCMD ["/bin/bash"]
Run the following pipeline on a Jenkins slave running Amazon Linux:
pipeline {
agent {
docker {
image 'your-mongo-image'
args '-u root'
}
}
stages {
stage('Test') {
steps {
sh 'service mongod start'
sh 'service mongod stop' // This is the step that hangs for 5 minutes before returning a non-zero exit status
}
}
}
}
environment
```
Jenkins 2.107.3
Amazon Linux 4.14.33-51.37.amzn1.x86_64
Docker version 17.12.1-ce, build 3dfb8343b139d6342acfd9975d7f1068b5b1c3d3
Java OpenJDK version 1.8.0_171
Jenkins installed via YUM, builds run on slaves connected via SSH
```
Contributor guide
Assessment
This issue has not been assessed yet.