Deprecated: Optional parameter $htmlString declared before required parameter $newClass is implicitly treated as a required parameter in /home/summary1/public_html/wp-content/plugins/wp-image-compression/lib/class-wp-image-compression.php on line 87

Deprecated: Return type of Requests_Cookie_Jar::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/summary1/public_html/wp-includes/Requests/Cookie/Jar.php on line 63

Deprecated: Return type of Requests_Cookie_Jar::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/summary1/public_html/wp-includes/Requests/Cookie/Jar.php on line 73

Deprecated: Return type of Requests_Cookie_Jar::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/summary1/public_html/wp-includes/Requests/Cookie/Jar.php on line 89

Deprecated: Return type of Requests_Cookie_Jar::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/summary1/public_html/wp-includes/Requests/Cookie/Jar.php on line 102

Deprecated: Return type of Requests_Cookie_Jar::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/summary1/public_html/wp-includes/Requests/Cookie/Jar.php on line 111

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/summary1/public_html/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 40

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/summary1/public_html/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 51

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/summary1/public_html/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 68

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/summary1/public_html/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 82

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/summary1/public_html/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 91

Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/summary1/public_html/wp-content/plugins/wordpress-seo/src/conditionals/third-party/elementor-edit-conditional.php on line 22

Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/summary1/public_html/wp-content/plugins/wordpress-seo/src/conditionals/third-party/elementor-edit-conditional.php on line 28

Notice: La fonction wp_add_inline_script a été appelée de façon incorrecte. Ne pas passer la balise <script> à wp_add_inline_script(). Veuillez lire Débogage dans WordPress (en) pour plus d’informations. (Ce message a été ajouté à la version 4.5.0.) in /home/summary1/public_html/wp-includes/functions.php on line 5831

Notice: La fonction wp_add_inline_script a été appelée de façon incorrecte. Ne pas passer la balise <script> à wp_add_inline_script(). Veuillez lire Débogage dans WordPress (en) pour plus d’informations. (Ce message a été ajouté à la version 4.5.0.) in /home/summary1/public_html/wp-includes/functions.php on line 5831
How to Run Jenkins Server in Docker Container with Systemd • Summary networks
Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /home/summary1/public_html/wp-content/plugins/wordpress-seo/src/generators/schema-generator.php on line 185

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/summary1/public_html/wp-content/plugins/jetpack/functions.compat.php on line 94

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/summary1/public_html/wp-content/plugins/jetpack/modules/photon-cdn.php on line 80

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/summary1/public_html/wp-content/plugins/jetpack/functions.compat.php on line 94

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/summary1/public_html/wp-content/plugins/jetpack/functions.compat.php on line 94

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/summary1/public_html/wp-content/plugins/jetpack/functions.compat.php on line 94

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/summary1/public_html/wp-content/plugins/jetpack/modules/photon-cdn.php on line 80

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/summary1/public_html/wp-content/plugins/jetpack/functions.compat.php on line 94

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/summary1/public_html/wp-content/plugins/jetpack/functions.compat.php on line 94

How to Run Jenkins Server in Docker Container with Systemd

[ad_1]

Repetitive tasks are usually tedious and end up taking up a lot of your time and energy. Over time, multiple automation tools have been developed to help alleviate the hassle of executing repetitive jobs. One such automation tool is Jenkins. Jenkins is an opensource automation server that is designed to help software developers build, test and deploy applications and thereby streamline the continuous integration and delivery process.  We have penned an article before on how to install Jenkins on CentOS 8/ RHEL 8. In this article, we will do things a little different and run the Jenkins server in a Docker container as a systemd service.

Prerequisites

A few things are required before you continue.

  • Docker installed on your Linux system.
  • A regular user with sudo privileges.

Step 1) Install Docker Engine

To begin, you need to have Docker engine installed on your system. We have a detailed article on how to install Docker on CentOS 8 / RHEL 8. Run below docker command to display the docker version

$ sudo docker version

From the snippet above, we have confirmed that docker is installed and that we are running docker version 19.03.13.

Step 2) Create a Jenkins user

Next, we will create a ‘Jenkins’ system user that will manage Jenkins service. But first, create a system group for Jenkins:

$ sudo groupadd --system jenkins

Then Create Jenkins system user

$ sudo useradd -s /sbin/nologin --system -g jenkins jenkins

And finally add Jenkins user to docker group as shown:

$ sudo usermod -aG docker jenkins

To confirm that Jenkins user is added to the docker group, run the id command as shown

$ id jenkins

Output will be,

[[email protected] ~]$ id jenkins
uid=991(jenkins) gid=986(jenkins) groups=986(jenkins),989(docker)
[[email protected] ~]$

Fantastic! Let’s proceed and pull a Jenkins image.

Step 3)  Pull Jenkins Image from Docker hub

Invoke the following command to pull the latest Jenkins image from Docker hub.

$ sudo docker pull jenkins/jenkins:lts

This usually takes a few seconds on a fairly stable internet connection. Once downloaded, verify that the Jenkins image is present by invoking the following command:

$ sudo docker images | grep jenkins

Output of above command would be:

[[email protected] ~]$ sudo docker images | grep jenkins
jenkins/jenkins     lts                 f669140ba6ec        6 days ago          711MB
[[email protected] ~]$

Jenkins requires a persistent storage to store data and re-use even in the event of a container crash. Therefore, we will create a storage directory as shown.

$ sudo mkdir /var/jenkins
$ sudo chown -R 1000:1000 /var/jenkins

Step 4) Create a systemd service for Jenkins

Using your preferred text editor, create a Jenkins systemd file as shown:

$ sudo vi /etc/systemd/system/jenkins-docker.service

Paste the following contents & save the file.

[Unit]
Description=Jenkins Server
Documentation=https://jenkins.io/doc/
After=docker.service
Requires=docker.service

[Service]
Type=simple
User=jenkins
Group=jenkins
TimeoutStartSec=0
Restart=on-failure
RestartSec=30s
ExecStartPre=-/usr/bin/docker kill jenkins-server
ExecStartPre=-/usr/bin/docker rm jenkins-server
ExecStartPre=/usr/bin/docker pull jenkins/jenkins:lts
ExecStart=/usr/bin/docker run  --name jenkins-server  --publish 8080:8080 --publish 50000:50000  --volume /var/jenkins:/var/jenkins_home  jenkins/jenkins:lts
SyslogIdentifier=jenkins
ExecStop=/usr/bin/docker stop jenkins-server

[Install]
WantedBy=multi-user.target

To start Jenkins service, reload systemd first and thereafter start Jenkins.

$ sudo systemctl daemon-reload
$ sudo systemctl start jenkins-docker

Let’s now check if Jenkins is running. To do so, we will execute:

$ sudo systemctl status jenkins-docker

Great ! Jenkins is up and running as a systemd service. Since Jenkins will be running on port 8080, open the port on the firewall as shown:

$ sudo firewall-cmd --permanent --add-port=8080/tcp
$ sudo firewall-cmd --reload

To set up Jenkins, simply browse the server’s URL as shown

http://server-ip:8080

You will get the ‘Unlock Jenkins’ page as shown. To proceed, you need to provide the password that is located in the file shown

[[email protected] ~]$ cat /var/jenkins/secrets/initialAdminPassword
9c61bd823a404056bf0a408f4622aafc
[[email protected] ~]$

Once done, Click on ‘Continue

Next, select ‘Install suggested plugins’ option as shown.

Thereafter, create an administrative user for the Jenkins account and click ‘Save and continue

The installer will guide you through the remaining steps right to the very end. After successfull Installation, we will get the following Jenkins dashboard

And it’s a wrap. In this guide, you learned how to run Jenkins inside a docker container as a systemd service.

Also ReadHow to Install and Configure Jenkins on Ubuntu 20.04

Source link

Mourad ELGORMA

Fondateur de summarynetworks, passionné des nouvelles technologies et des métiers de Réseautique , Master en réseaux et système de télécommunications. ,j’ai affaire à Pascal, Delphi, Java, MATLAB, php …Connaissance du protocole TCP / IP, des applications Ethernet, des WLAN …Planification, installation et dépannage de problèmes de réseau informatique……Installez, configurez et dépannez les périphériques Cisco IOS. Surveillez les performances du réseau et isolez les défaillances du réseau. VLANs, protocoles de routage (RIPv2, EIGRP, OSPF.)…..Manipuler des systèmes embarqués (matériel et logiciel ex: Beaglebone Black)…Linux (Ubuntu, kali, serveur Mandriva Fedora, …). Microsoft (Windows, Windows Server 2003). ……Paquet tracer, GNS3, VMware Workstation, Virtual Box, Filezilla (client / serveur), EasyPhp, serveur Wamp,Le système de gestion WORDPRESS………Installation des caméras de surveillance ( technologie hikvision DVR………..). ,

Laisser un commentaire


Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/summary1/public_html/wp-content/plugins/jetpack/functions.compat.php on line 94

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/summary1/public_html/wp-content/plugins/jetpack/modules/photon-cdn.php on line 80

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/summary1/public_html/wp-content/plugins/jetpack/functions.compat.php on line 94

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/summary1/public_html/wp-content/plugins/jetpack/functions.compat.php on line 94

Fatal error: Uncaught Error: Call to undefined function W3TC\chmod() in /home/summary1/public_html/wp-content/plugins/w3-total-cache/Cache_File_Generic.php:68 Stack trace: #0 /home/summary1/public_html/wp-content/plugins/w3-total-cache/PgCache_ContentGrabber.php(2177): W3TC\Cache_File_Generic->set('summarynetworks...', Array, 3600, '') #1 /home/summary1/public_html/wp-content/plugins/w3-total-cache/PgCache_ContentGrabber.php(444): W3TC\PgCache_ContentGrabber->_maybe_save_cached_result('<br />\n<b>Depre...', Array, false) #2 [internal function]: W3TC\PgCache_ContentGrabber->ob_callback('<br />\n<b>Depre...') #3 /home/summary1/public_html/wp-content/plugins/w3-total-cache/Util_Bus.php(21): call_user_func(Array, '<br />\n<b>Depre...') #4 /home/summary1/public_html/wp-content/plugins/w3-total-cache/Generic_Plugin.php(532): W3TC\Util_Bus::do_ob_callbacks(Array, '<br />\n<b>Depre...') #5 [internal function]: W3TC\Generic_Plugin->ob_callback('<br />\n<b>Depre...', 9) #6 /home/summary1/public_html/wp-includes/functions.php(5275): ob_end_flush() #7 /home/summary1/public_html/wp-includes/class-wp-hook.php(307): wp_ob_end_flush_all('') #8 /home/summary1/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array) #9 /home/summary1/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array) #10 /home/summary1/public_html/wp-includes/load.php(1102): do_action('shutdown') #11 [internal function]: shutdown_action_hook() #12 {main} thrown in /home/summary1/public_html/wp-content/plugins/w3-total-cache/Cache_File_Generic.php on line 68