uname gives you kernel informations, and the kernel is shared between
dockerhost and container.

2017-02-16 17:09 GMT+01:00 Tom Lester <t...@tomlester.com>:

> It also seems like my sh command are not running in the container.   For
> example... If you see this Jenkins file:
>
> node {
>   ECR_LOGIN = sh (
>   script: 'aws ecr get-login',
>   returnStdout: true
>   ).trim()
>   sh "${ECR_LOGIN}"
>   docker.image('129132148275.dkr.ecr.us-east-1.amazonaws.
> com/gobuild-base:latest').inside {
>
>     stage("Build") {
>       sh 'uname -a'
>     }
>   }
> }
>
> If I'm understanding this correctly, uname -a should return the OS info
> from the container.   Instead it is returning the OS info of the AWS EC2
> instance.  Here's the output:
>
> Running on docker001 in 
> /home/jenkins/workspace/ity-service_tlester_jenkins-ZAK24AVEOSII6FI5ZPP6GCRQQ7ISJCROTD5BZVI3M4MT7EMS4ERA[Pipeline]
>  {[Pipeline] 
> sh[ity-service_tlester_jenkins-ZAK24AVEOSII6FI5ZPP6GCRQQ7ISJCROTD5BZVI3M4MT7EMS4ERA]
>  Running shell script
> + aws ecr get-login[Pipeline] 
> sh[ity-service_tlester_jenkins-ZAK24AVEOSII6FI5ZPP6GCRQQ7ISJCROTD5BZVI3M4MT7EMS4ERA]
>  Running shell script
> + docker login -u AWS -p
> <snip>
>
> Login Succeeded[Pipeline] 
> sh[ity-service_tlester_jenkins-ZAK24AVEOSII6FI5ZPP6GCRQQ7ISJCROTD5BZVI3M4MT7EMS4ERA]
>  Running shell script
> + docker inspect -f . 
> 129132148275.dkr.ecr.us-east-1.amazonaws.com/gobuild-base:latest
> .[Pipeline] withDockerContainer$ docker run -t -d -u 501:501 -w 
> /home/jenkins/workspace/ity-service_tlester_jenkins-ZAK24AVEOSII6FI5ZPP6GCRQQ7ISJCROTD5BZVI3M4MT7EMS4ERA
>  -v 
> /home/jenkins/workspace/ity-service_tlester_jenkins-ZAK24AVEOSII6FI5ZPP6GCRQQ7ISJCROTD5BZVI3M4MT7EMS4ERA:/home/jenkins/workspace/ity-service_tlester_jenkins-ZAK24AVEOSII6FI5ZPP6GCRQQ7ISJCROTD5BZVI3M4MT7EMS4ERA:rw
>  -v 
> /home/jenkins/workspace/ity-service_tlester_jenkins-ZAK24AVEOSII6FI5ZPP6GCRQQ7ISJCROTD5BZVI3M4MT7EMS4ERA@tmp:/home/jenkins/workspace/ity-service_tlester_jenkins-ZAK24AVEOSII6FI5ZPP6GCRQQ7ISJCROTD5BZVI3M4MT7EMS4ERA@tmp:rw
>  -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e 
> ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e 
> ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e 
> ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat 
> 129132148275.dkr.ecr.us-east-1.amazonaws.com/gobuild-base:latest[Pipeline] 
> {[Pipeline] stage[Pipeline] { (Build)[Pipeline] 
> sh[ity-service_tlester_jenkins-ZAK24AVEOSII6FI5ZPP6GCRQQ7ISJCROTD5BZVI3M4MT7EMS4ERA]
>  Running shell script
> + uname -a
> Linux 3cb0b774fe50 4.4.23-31.54.amzn1.x86_64 #1 SMP Tue Oct 18 22:02:09 UTC 
> 2016 x86_64 Linux[Pipeline] }[Pipeline] // stage
>
> [Pipeline] }$ docker stop --time=1 
> 3cb0b774fe50fa3e603146ffc791fc40f5464959f95bea5dbc87ac80f45ae217
> $ docker rm -f 
> 3cb0b774fe50fa3e603146ffc791fc40f5464959f95bea5dbc87ac80f45ae217[Pipeline] // 
> withDockerContainer[Pipeline] }[Pipeline] // node[Pipeline] End of Pipeline
>
>
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/0c65bdef-9a3a-41ae-939b-35c41a7df8e5%40googlegroups.
> com
> <https://groups.google.com/d/msgid/jenkinsci-users/0c65bdef-9a3a-41ae-939b-35c41a7df8e5%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CANMVJz%3DnrF9ExcPQSKja-0Qe6KjMxuW_HXCrpHSaBfd_vxBFDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to