Francis Chuang
unread,Jun 12, 2019, 7:27:53 AM6/12/19Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jenkins...@googlegroups.com
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