Jenkins Pipelines CD and a Dockerized App

I did same as in the video in lab server but the only thing is  how to configure deploy server. i tried with Tomcat server it is not working.
  • post-author-pic
    Will B
    08-30-2018

    You don't need a tomcat server, just Docker. You also need to create a user with some necessary permissions.


    Here's an example:
    adduser deploy
    echo "deploy:jenkins" | chpasswd
    groupadd docker
    usermod -a -G docker deploy
    echo "deploy ALL=(ALL) NOPASSWD: /usr/bin/docker run *" >> /etc/sudoers
    echo "deploy ALL=(ALL) NOPASSWD: /usr/bin/docker pull *" >> /etc/sudoers
    /usr/bin/yum -y install docker
    /usr/bin/systemctl enable docker
    /usr/bin/systemctl start docker
    If you create the docker group after installing docker, then restart the docker service after creating the group.

  • post-author-pic
    Hari P
    08-31-2018

    i spined 2 cloud servers, in that i installed java, git, Jenkins, and docker. then accessed Jenkins login page and went to configure system -  Environment variables- in that i want to give production ip which i p I want to give. please suggest me

  • post-author-pic
    Will B
    08-31-2018

    Each cloud server has 2 IPs, the private IP and the public IP. You can see them on the page where you start them after they spin up. You should use the private IP because it doesn't change unless you delete the server.

  • post-author-pic
    Hari P
    08-31-2018

    so, one server is fine?. in one server itself i can install Docker, git, java, and Jenkins, and output also can view?  till i didn't get clarity. 

  • post-author-pic
    Hari P
    09-03-2018

    i did the same till getting below error

    Deploy to Production?

    Proceed or Abort

    Approved by jenkins

    [Pipeline] milestone

    Trying to pass milestone 1

    [Pipeline] withCredentials

    [Pipeline] {

    [Pipeline] script

    [Pipeline] {

    [Pipeline] sh

    [train-schedule_master-ESGKM5F7W43U3ERZNSPNBFMAA2G2YGCOVLG7NVF27GPRDB5CIFSQ] Running shell script

    + sshpass -p **** -v ssh -o StrictHostKeyChecking=no ****@52.221.253.126 'docker pull dockerpandian/train-schedule:4'

    /var/lib/****/workspace/train-schedule_master-ESGKM5F7W43U3ERZNSPNBFMAA2G2YGCOVLG7NVF27GPRDB5CIFSQ@tmp/durable-43af9f66/script.sh: line 2: sshpass: command not found

    [Pipeline] }

    [Pipeline] // script

    [Pipeline] }

    [Pipeline] // withCredentials

    [Pipeline] }

    [Pipeline] // stage

    [Pipeline] }

    [Pipeline] // withEnv

    [Pipeline] }

    [Pipeline] // node

    [Pipeline] End of Pipeline

    Could not update commit status, please check if your scan credentials belong to a member of the organization or a collaborator of the repository and repo:status scope is selected

    GitHub has been notified of this commit’s build result

    ERROR: script returned exit code 127

    Finished: FAILURE


  • post-author-pic
    Will B
    09-04-2018

    Install sshpass on the jenkins server:
    yum -y install sshpass

  • post-author-pic
    Romeo P
    09-06-2018

    I experienced the same issue that I mitigated by installing sshpass on the Ubuntu box referrenced. However, now I'm getting  Permission denied (publickey,password). issue. Deploy to Production?

    Proceed or Abort

    Approved by jenkins

    [Pipeline] milestone

    Trying to pass milestone 1

    [Pipeline] withCredentials

    [Pipeline] {

    [Pipeline] script

    [Pipeline] {

    [Pipeline] sh

    [train-schedule_master-ESGKM5F7W43U3ERZNSPNBFMAA2G2YGCOVLG7NVF27GPRDB5CIFSQ] Running shell script

    + sshpass -p **** -v ssh -o StrictHostKeyChecking=no ****@34.216.133.116 'docker pull sugarhillconsultants/train-schedule:15'

    Warning: Permanently added '34.216.133.116' (ECDSA) to the list of known hosts.

    SSHPASS searching for password prompt using match "assword"

    SSHPASS read: ****@34.216.133.116's password:

    SSHPASS detected prompt. Sending password.

    SSHPASS read:

    Permission denied, please try again.

    SSHPASS read: ****@34.216.133.116's password:

    SSHPASS detected prompt, again. Wrong password. Terminating.

    Permission denied, please try again.

    Permission denied (publickey,password).

    [Pipeline] }

    [Pipeline] // script

    [Pipeline] }

    [Pipeline] // withCredentials

    [Pipeline] }

    [Pipeline] // stage

    [Pipeline] }

    [Pipeline] // withEnv

    [Pipeline] }

    [Pipeline] // node

    [Pipeline] End of Pipeline

    Could not update commit status, please check if your scan credentials belong to a member of the organization or a collaborator of the repository and repo:status scope is selected

    GitHub has been notified of this commit’s build result

    ERROR: script returned exit code 5

    Finished: FAILURE

  • post-author-pic
    Hari P
    09-10-2018








    after install1 sshpass getting bellow message 

    8299bdc7f71722629cc50db9c5547b41e1c8227ea229d51ff15527877c6b501a

    /usr/bin/docker-current: Error response from daemon: driver failed programming external connectivity on endpoint train-schedule (a5d499a5bc97d22c7901eaf4af4294548d92cd034db168c713e9cf760a37fe81): Error starting userland proxy: listen tcp 0.0.0.0:8080: bind: address already in use.

    [Pipeline] }

    [Pipeline] // script

    [Pipeline] }

    [Pipeline] // withCredentials

    [Pipeline] }

    [Pipeline] // stage

    [Pipeline] }

    [Pipeline] // withEnv

    [Pipeline] }

    [Pipeline] // node

    [Pipeline] End of Pipeline

    GitHub has been notified of this commit’s build result

    ERROR: script returned exit code 125

    Finished: FAILU

  • post-author-pic
    Hari P
    09-10-2018

    i did the same in the second system and now it is working fine

Looking For Team Training?

Learn More