Deploying Jenkins with Azure Container Instances

Deploying Jenkins Containers With Azure Container Instances
 
One of the best things about Azure cloud containers is the ability to get an application up and running so incredibly quickly. And the first thing you want to do is familiarize yourself with the layout of containers and Docker, in general.
 
Deploying Jenkins Containers With Azure Container Instances
 
Here you can find all of these containers and all of these applications that are available to you, called the Docker Hub or hub.docker.com.
 
Deploying Jenkins Containers With Azure Container Instances
 
You can simply scroll on down. And you can see all of the available ones that are available to you just on the Home page alone. You can see a Redis cache. You can see NGINX. That's pretty cool. An official Ubuntu image, MySQL or Postgre databases, apache, hello world-- just anything that we need to get this thing up and running.
 
Deploying Jenkins Containers With Azure Container Instances
 
Jenkins is an amazing automation tool. So, if you simply search for Jenkins an official Jenkins Docker image will show up. Let's go and give that a click.
 
Deploying Jenkins Containers With Azure Container Instances
 
And I can see that the official Docker image for Jenkins is right here available to use but there is a deprecation notice “this image has been deprecated in favour of jenkins/Jenkins”. Well, let's go ahead and give that a click and get to the right instance of Jenkins.
 
Deploying Jenkins Containers With Azure Container Instances
 
There we go. And now I can see this was updated recently. The owner is Jenkins. This is the official release for Jenkins. So, is there anything special I need to know about running Jenkins in particular in Docker? Let's just go ahead and go to the documentation and see for sure.
 
Deploying Jenkins Containers With Azure Container Instances
 
And just looking at the very initial command to get this thing up and running, it looks like it needs port 8080 open in order to be accessible. So, with that in mind, I was going to remember that 8080 needs to be up and running so that we can get started with Azure. Now, as I said previously, deploying a container in Azure with Azure Container Instances is insanely easy. Just like you can deploy a virtual machine pretty quickly, we can deploy this application pretty quickly in Azure. And it's going to be publicly accessible or however else I want to control it. So, to get this going, I'm just going to copy, right here, the little name of the Jenkins instance that we've got because this is the official Jenkins documentation. And all we need to have the name of the Docker hub accessible version of Jenkins available. So, we'll just go ahead and copy “jenkins/jenkins:lts”.
 
Deploying Jenkins Containers With Azure Container Instances
 
And we'll hop it over to the Azure portal. And we'll get started deploying this in an Azure Container Instance. I'm simply going to click Create a Resource. And we're going to search for the container instance. We'll go ahead and give that a click.
 
Deploying Jenkins Containers With Azure Container Instances
 
And we'll click Create to get started creating a Container Instance.
 
Deploying Jenkins Containers With Azure Container Instances
 
The Basics
 
Container Name
csharpjenkins
Container Type
Public
Container Image
jenkins/jenkins:lts
Subscription
MVP-Subscription (you can use your own)
Resource Group
CsharpJenkins (Create New)
Location
Southeast Asia
OS Type
Linux
Number of cores
2
Memory (GB)
4
GPU
0

Deploying Jenkins Containers With Azure Container Instances
 
Networking
Networking
Yes
DNS name label
csharpjenkins
Port
8080
Open additional ports
Yes
Port
50000
Port protocol
TCP
 
Leave the Advanced settings as I don’t need to specify any environment variables or any command overrides, So, lets click Review + Create.
 
Deploying Jenkins Containers With Azure Container Instances
 
And here is my summary. We're going to be deploying jenkins/jenkins:lts. We're going to give it two cores and four gigs of RAM, which is way too much for this particular container. But that's fine. We've got a DNS label. We're opening Port 8080 and 50000 on TCP. Let's go and give us this a click Create.
 
Deploying Jenkins Containers With Azure Container Instances
 
And that should start deploying my Jenkins Container. Now, Jenkins, in particular, can take a while to get up and running. It does need to be warmed up, so to speak. So, I'm going to let this run for several minutes before we come back to it and test it out and make sure it's running. And it says, after a minute and 20 seconds, the deployment is complete and that this container is up and running so, let’s Go to resource.
 
Deploying Jenkins Containers With Azure Container Instances
 
So, I'm simply going to copy the fully-qualified domain name right here. We'll just give it a click to copy. We'll open a new tab. I'll paste it in. And remember, this is on Port 8080.
 
Deploying Jenkins Containers With Azure Container Instances
 
So, we'll go ahead and type in colon 8080 with the FQDN,“csharpjenkins.southeastasia.azurecontainer.io” look at that. There it is, Jenkins, up and running on a container-- took almost no time at all to get this thing up and running. That's the magic of Azure Container Instances, and how quickly we can go about deploying containers in our Azure environment.
 
I hope this article has been informative for you. Thank you for reading.