I currently have a docker-compose.yml file that is used to perform a
jekyll build using `docker-compose run` as a one-off command:
version: '3.7'
services:
build-site:
image: jekyll/jekyll:3
command: jekyll build
volumes:
- .:/srv/jekyll
volumes:
- ../:/usr/src/calcite
This works really well locally. I just run `docker-compose run
build-site` and it will build the files and terminate after the command
finishes.
The problem is that when I do the same on Jenkins, it hangs. My
jenkinsfile looks like this:
pipeline {
agent {
node {
label 'git-websites'
}
}
environment {
COMPOSE_PROJECT_NAME = "${env.JOB_NAME}-${env.BUILD_ID}"
}
options {
timeout(time: 20, unit: 'MINUTES')
}
stages {
stage('Build') {
steps {
dir ("site") {
sh 'docker-compose --verbose run -e JEKYLL_UID=$(id
-u) -e JEKYLL_GID=$(id -g) build-site'
}
echo "Done generating"
}
}
}
}
When this is executed on Jenkins, the shell step executing
docker-compose never terminates and the echo step never runs. The job
then times out and is killed even though the command in the container
completed successfully.
I also tried to run to run a simple docker command to test: `docker run
alpine whoami`. This prints the current user in the container and hangs.
In addition, I also tried playing around with `tty`, `stdin_open` and
`init` in the docker-compose file, but the step still hangs.
Has anyone gotten docker-compose to work with the shell step? If so, is
there something I am missing?
Francis
--
You received this message because you are subscribed to the Google Groups "Jenkins
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/002a3c0b-a9ee-7576-ce4e-f5afb8178b43%40apache.org.
For more options, visit https://groups.google.com/d/optout.