Download here: http://gg.gg/o0kui
What is Docker? Docker is a free and open source software tool that can be used to pack, ship and run any application as a container. It has not any packaging system or frameworks, it can be run from anywhere from a small computer to large servers. You can easily deploy and scale your applications, databases and other services without depending on any provider.
What is Jenkins? Jenkins is a free and open source automation tool that can be used to automate repetitive technical tasks with the help of continuous integration and continuous delivery.
In this tutorial, we will explain how to install Jenkins with Docker on Ubuntu 18.04 server. We will also explain how to run Jenkins with Docker in a way to keep Jenkins data and configurations persistent.
*A server running Ubuntu 18.04 with minimum 2 GB of RAM.
*A root password is set up on your server.
*Jenkins Installation. Jenkins installation is pretty much straight forward for both Windows and Mac!
*Permalink to the latest: 2.264: SHA-1: a0fc51c62d59e5f7389c1c5fa532026c8df94562, SHA-256: 5a999af2b91bcc3c5a1c8376214d26a1e7f63fa9e822d2ea0c9011.Download Jenkins War For WindowsGetting Started
Let’s start to update your server’s repository with the latest version. You can update it with the following command:
Jenkins can be installed on Windows, Mac OS X, Ubuntu/Debian, Red Hat/Fedora/CentOS, openSUSE, FReeBSD, OpenBSD, Gentoo. Click on Generic Java Package (.war) to download the Jenkins war file. Starting Jenkins. Open the command prompt and go to the directory where the Jenkins.war file is located. And then run the following command. Hey guys, in this post will learn about how to download and install Jenkins on Mac. Jenkins is a self-contained, open-source automation server that can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software.
Once the repository has been updated, restart your server to apply all these changes.Install Docker
Next, you will need to install Docker in your server.
First, download and add Docker CE GPG key with the following command:wget https://download.docker.com/linux/ubuntu/gpgapt-key add gpg
Next, add the Docker CE repository to APT with the following command:
Add the following line:deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
Save and close the file, when you are finished. Then, update the repository with the following command:
Once the repository is updated, install Docker CE with the following command:
After installing Docker CE, verify the Docker installation with the following command:Create Docker Volume for Data and Log
Docker volume is a method for persisting data and configuration in Docker containers. When you remove any container, the data and configurations are still available in the Docker volume. So you will need to create a data and log volumes to backup Jenkins data and configurations including, logs, plugins, plugin configuration and job config.
Let’s start with creating volume for data and log with the following command:docker volume create jenkins-datadocker volume create jenkins-log
Once the volumes are created, you can list them with the following command:
You should see the following output:DRIVER VOLUME NAMElocal jenkins-datalocal jenkins-logInstall Jenkins with Docker
Next, you will need to create a docker file to pull and build Jenkins image with required settings.
You can create docker file with the following command:
Add the following lines:FROM jenkins/jenkinsLABEL maintainer=’hitjethva@gmail.com’USER rootRUN mkdir/var/log/jenkinsRUN mkdir/var/cache/jenkinsRUN chown-R jenkins:jenkins /var/log/jenkinsRUN chown-R jenkins:jenkins /var/cache/jenkinsUSER jenkinsENV JAVA_OPTS=’-Xmx8192m’ENV JENKINS_OPTS=’--handlerCountMax=300 --logfile=/var/log/jenkins/jenkins.log--webroot=/var/cache/jenkins/war’
Save and close the file, when you are finished. Then, build the Jenkins image with the following command:
You should see the following output:Sending build context to Docker daemon 2.048kBStep 1/10 : FROM jenkins/jenkins---> ae831925b271Step 2/10 : LABEL maintainer=’hitjethva@gmail.com’---> Running in 673bf1ecc3eaRemoving intermediate container 673bf1ecc3ea---> cad1bee88092Step 3/10 : USER root---> Running in 36909c427d44Removing intermediate container 36909c427d44---> 2c381cc3a773Step 4/10 : RUN mkdir/var/log/jenkins---> Running in 337c0310db99Removing intermediate container 337c0310db99---> 5aa93b90c67eStep 5/10 : RUN mkdir/var/cache/jenkins---> Running in 2c77577ae28bRemoving intermediate container 2c77577ae28b---> 5016430c07ebStep 6/10 : RUN chown-R jenkins:jenkins /var/log/jenkins---> Running in e4c820f66103Removing intermediate container e4c820f66103---> c8d2830a84c5Step 7/10 : RUN chown-R jenkins:jenkins /var/cache/jenkins---> Running in d024606146d5Removing intermediate container d024606146d5---> a11d613cff18Step 8/10 : USER jenkins---> Running in 478f3c067131Removing intermediate container 478f3c067131---> edea568d5564Step 9/10 : ENV JAVA_OPTS=’-Xmx8192m’---> Running in 5ae52922f52bRemoving intermediate container 5ae52922f52b---> cb1285b1bc72Step 10/10 : ENV JENKINS_OPTS=’--handlerCountMax=300 --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war’---> Running in 973fb9257c29Removing intermediate container 973fb9257c29---> b131c5adf03eSuccessfully built b131c5adf03eSuccessfully tagged myjenkins:latest
The new Jenkins image with name myjenkins has been built successfully.Run Jenkins Container with Data and Log Volume
Jenkins image is now built with required settings. Next, you will need to run Jenkins container by specifying data and log volumes as a mount point.
You can run the Jenkins container with the following command:docker run -p8080:8080-p50000:50000--name=jenkins-master --mountsource=jenkins-log,target=/var/log/jenkins --mountsource=jenkins-data,target=/var/jenkins_home -d myjenkins
Once the Jenkins container is started, you can verify the running container with the following command:
You should see the following output:CONTAINER ID IMAGE COMMAND CREATED STATUS 3dec02a7077c myjenkins ’/sbin/tini -- /usr/…’6 minutes ago Up 6 minutes PORTS NAMES0.0.0.0:8080->8080/tcp, 0.0.0.0:50000->50000/tcp jenkins-master
Next, you will need to check the jenkins log file whether everything is working fine or not:docker exec jenkins-master tail-f/var/log/jenkins/jenkins.log
You should see the following output:
Please use the following password to proceed to installation:b437ba21655a44cda66a75b8fbddf5b8This may also be found at: /var/jenkins_home/secrets/initialAdminPassword***************************************************************************************************************************************************************************************
Please note the above password, you will need it during the Jenkins web set up wizard.Access Jenkins Web Interface
Now, open your web browser and type the URL http://your-server-ip:8080. You will be redirected to the Jenkins setup screen as shown below:
Provide your administrator password and click on the Continue button. You should see the following page:
Now, click on the “Install suggested plugins” to install the required plugins. Once the installation has been finished. You should see the following page:
Now, provide your admin username, password and full name then click on the SaveandFinish button. You should see the following page:
Now, just click on the Save and Finish button. Once the setup completed successfully, you should see the following page:
Now, click on the “Start using Jenkins“. You will be redirected to the Jenkins dashboard as shown in the following page:
Now, click on the “create new jobs” button. You should see the following page:
Now, provide your job name and click on the OK button. You should see the following page:
Now, click on the Save button to save all the settings. You should see your newly created jobs in the following page:Test Jenkins Persistent DataUpdate Jenkins War
Jenkins is now installed and configured. Next, you will need to test whether Jenkins data and log are still persisting after removing the Jenkins container.
To do so, first stop and delete the Jenkins container with the following command:docker stop jenkins-masterdocker rm jenkins-master
Now, start the Jenkins container again with the following command:docker run -p8080:8080-p50000:50000--name=jenkins-master --mountsource=jenkins-log,target=/var/log/jenkins --mount ​source=jenkins-data,target=/var/jenkins_home -d myjenkins
Once the Jenkins container has been started, open your web browser and type the URL http://your-server-ip:8080. You will be redirected to the following page:Jenkins War Files
Now, provide your admin user name and password then click on the Signin button. You should see the Jenkins dashboard in the following page:
That means you have preserved all the data, logs, setup configuration and plugin installs. You should also see that your myjenkinsjob is still there.Jenkins War DownloadCONCLUSIONDownload Jenkins War Files
Now you can containerize your devop process with Jenkins and Docker, enjoy.
Download here: http://gg.gg/o0kui

https://diarynote-jp.indered.space

コメント

最新の日記 一覧

<<  2025年7月  >>
293012345
6789101112
13141516171819
20212223242526
272829303112

お気に入り日記の更新

テーマ別日記一覧

まだテーマがありません

この日記について

日記内を検索