my_container = docker.image("srrdr.it/isl-ds/${microserviceName}-prod:${my_build_number}")
// do the following build steps inside a container started from the custom image above
my_container.inside("-e \"SONARQUBE_HOST=${sonarqubeUrl}\"") {
sh 'sleep 20'
sh 'curl http://localhost:5000/keyserviceapi/api/v1/version >> ./output.txt'
sh 'grep OK output.txt'
}
CMD ["./script.sh", "start"]
docker run -t -d -u 0:0 -e SONARQUBE_HOST=http://srrdr.it:8091 -w /tmp/jenkins/workspace/isl-ds-keyserviceapi-pipeline-1 --volumes-from 0f5d48be8450a0eb5c324976ddb81483ef86edff20651dfb0d1350f7d065566c -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ********
-e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** srrdr.it/isl-ds/isl-ds-prod:1.0.0 cat
CMD ["./script.sh", "start"]
$ docker run -t -d -u 0:0 -e SONARQUBE_HOST=http://srrdr.it:8091 -w /tmp/jenkins/workspace/isl-ds-keyserviceapi-pipeline-1 --volumes-from 0f5d48be8450a0eb5c324976ddb81483ef86edff20651dfb0d1350f7d065566c -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** srrdr.it/isl-ds/isl-ds-prod:1.0.0 cat $ docker top 434266a0ba7ec69a960ec0ff3f544d1f771b3364f74b0763306a928b7ee87595 -eo pid,comm ERROR: The container started but didn't run the expected command. Please double check your ENTRYPOINT does execute the command passed as docker run argument, as required by official docker images (see https://github.com/docker-library/official-images#consistency for entrypoint consistency requirements). Alternatively you can force image entrypoint to be disabled by adding option `--entrypoint=''`.
I'm quite lost about this, apparently there is no way to start a service with .inside().
Can anyone enlighten me?
Thank you as always,
Roberto
--
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 jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a21ef152-9500-4ce1-98c6-fe00124c3b8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#!/usr/bin/env sh
# $0 is a script name,
# $1, $2, $3 etc are passed arguments
# $1 is our command
CMD=$1
case "$CMD" in
"dev" )
npm install
export NODE_ENV=development
exec npm run dev
;;
"start" )
# we can modify files here, using ENV variables passed in
# "docker create" command. It can't be done during build process.
echo "db: $DATABASE_ADDRESS" >> /app/config.yml
export NODE_ENV=production
exec npm start
;;
* )
# Run custom command. Thanks to this line we can still use
# "docker run our_image /bin/bash" and it will work
exec $CMD ${@:2}
;;
esac
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f195d930-62a6-48c2-aef0-796985a533e6%40googlegroups.com.
Rewrite your script so default is to run "npm start" in background then exec $@, and declare ENTRYPOINT script.sh without argument
docker run -d <image>
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3d1402b3-445d-401e-96ce-2de2720ed389%40googlegroups.com.
To be more clear, we still use .inside() if we use a container as a build environment inside which we do mvn or similar commands, but we've moved to the withRun approach if we are in a test scenario where a "service" is started via ENTRYPOINT.
--
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 jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ce0a8193-581f-4d25-a965-963ea8a8175c%40googlegroups.com.
Definitely agree, our scenario wasn't so much of a complex mesh of services tho, but rather the fact that testing the service from inside the container (hence the localhost:container_port test that we wanted to ran directly inside the container itself) would make it possible for us to avoid a few caveats that withRun poses, like binding container->host ports, which can be somewhat of a pain if the jenkins server is "multi tenant".Anyways, you definitely cleared up so many things for us, so we thank you a lot for your time and help Nicolas!
--
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 jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/edb0a91f-27fc-47f0-8a88-bd97076883a0%40googlegroups.com.
--
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 jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/558d06da-8246-4c80-9abb-68d73b81b7f4%40googlegroups.com.