Jenkins Setup On Digital- Ocean Cloud ( Run Jenkins as a Docker container )
Tags: jenkins, devops, cloudskills
Published: 2023-03-26 08:23:45

Jenkins is an open-source automation server that can be used to automate various tasks like building, testing, and deploying software. 

DigitalOcean is a cloud hosting platform that provides a simple and cost-effective way to deploy and manage applications in the cloud. 

In this blog, we will discuss how to set up Jenkins on DigitalOcean cloud.

To set up Jenkins on DigitalOcean, the first step is to create a Droplet. 

A Droplet is a virtual machine that can be used to host applications in the cloud. To create a Droplet, follow these steps:

**Step 1**: Create a Droplet on DigitalOcean

1) Log in to your DigitalOcean account. Click on the "Create" button and select "Droplets."
  
![Create a Droplet on DigitalOcean](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5p1zajoib6lbdjpkqru5.png)

2) Choose Region

![Choose Region](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rfetidih7qc9m9qg6gnt.png)

3) Choose an Image

![Choose an Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z4h4ptq4jbb4yd3kqx6r.png)

4) Choose size

![Choose size](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nswd5z2p1pdbb822yxfy.png)


![Choose size](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s5ki26g30my1fxckc1g1.png)

5) Choose Authentication Method

 i) Password

![Choose Authentication Method Password ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1vjc5bhp1uq70bsab51g.png)

 ii) SSH key (We are Using)

![Choose Authentication Method SSH key](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hgwfz58ru5ptvn2tccjn.png)

![Choose Authentication Method SSH key](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h981hdkn65d594s9dg1z.png)

6) Click on the **Create Droplet** button to create your Droplet.

![Create Droplet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7iruoygj0gifj032s0s8.png)

Rename droplet name : 

![Rename droplet name ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqa97xpzbjmjrzlat5dm.png)
 

7) Click on Networking and click on **Create Firewall** button 


![Create Firewall](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uj976kgt49dndr9dh3hz.png)


Inbound Rules :


![Inbound Rules](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b87v1rxx4kigc3zy4zwc.png)

Outbound Rules : 

![Outbound Rules](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ohbt4ecbdm4av0nmivda.png)

Firewall Created :

![Firewall Created ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l9yrnitz2bur0adcqlpq.png)

**Step 2**: Install Docker on your Droplet

1) SSH to your droplet 

Copy your droplet's IPV4 

![Copy your droplet's IPV4 ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ljjlt2cqwn1vw91x7ft.png) 

2) Update your package index by running the command:
     `apt update`

3) Install docker by running the command :
     `apt install docker.io`


**Step 3**: Install Jenkins on Docker container

1) `docker run -p 8080:8080 -p 50000:50000 -d -v
   jenkins_home:/var/jenkins_home jenkins/jenkins:lts`

2) `docker ps`
 
![docker ps](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y5cqz4pm30o9v5uf7e9k.png) 

3) Access Jenkins on web-browser via typing
   ip_address:jenkins_port

![Access Jenkins on web-browser via typing ip_address:jenkins_port](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/okom9odra0l78ty5wy7f.png)

4) Getting Unlock Jenkins Password

![Getting Unlock Jenkins Password](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3y4yd7mh9p2e0m5ks15u.png)

5) Install Suggested Plugins

![Install Suggested Plugins](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ihpbs07u4mda2o7gzoio.png)
   
![Install Suggested Plugins](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/prtqmtxkxm63pyzyvtck.png)

6) Create First Admin User

![Create First Admin User](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kgun3oa01b0ytdg9lz4u.png)


Congratulations🥳

![Congratulations](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bvwvcgeynoqcqq7b1r9y.png)

- Follow me! @ayushdabhi

 #jenkins #devops #cloud #digitalocean