- Docker Jenkins Install In Chrome
- Docker Jenkins Installation
- Docker Jenkins Install Ubuntu
- Docker Jenkins Install Python
Mar 06, 2019 In this article, we will show you how to install Docker CE (Community Edition), create and run Docker containers on Ubuntu distribution. Installing Docker CE (Community Edition) in Ubuntu. To install Docker CE, first, you need to remove older versions of Docker were called docker, docker.io, or docker-engine from the system using the. To summarize, we showed the steps how to install Jenkins with Docker. Deploying the Jenkins with Docker is a good solution because it reduces the maintenance on the host level and also reduces the need to run maintenance on Java, since the Jenkins in Docker comes together with Java pre-installed and configured.
-->Important
Many Azure services have Jenkins plug-ins. Some of these plug-ins will be out of support as of February 29, 2024. Azure CLI is the currently recommended way to integrate Jenkins with Azure services. For more information, refer to the article Jenkins plug-ins for Azure.
To automate the build and test phase of application development, you can use a continuous integration and deployment (CI/CD) pipeline. In this tutorial, you create a CI/CD pipeline on an Azure VM including how to:
- Create a Jenkins VM
- Install and configure Jenkins
- Create webhook integration between GitHub and Jenkins
- Create and trigger Jenkins build jobs from GitHub commits
- Create a Docker image for your app
- Verify GitHub commits build new Docker image and updates running app
This tutorial uses the CLI within the Azure Cloud Shell, which is constantly updated to the latest version. To open the Cloud Shell, select Try it from the top of any code block.
If you choose to install and use the CLI locally, this tutorial requires that you are running the Azure CLI version 2.0.30 or later. Run az --version
to find the version. If you need to install or upgrade, see Install Azure CLI.
Create Jenkins instance
In a previous tutorial on How to customize a Linux virtual machine on first boot, you learned how to automate VM customization with cloud-init. This tutorial uses a cloud-init file to install Jenkins and Docker on a VM. Jenkins is a popular open-source automation server that integrates seamlessly with Azure to enable continuous integration (CI) and continuous delivery (CD). For more tutorials on how to use Jenkins, see the Jenkins in Azure hub.
In your current shell, create a file named cloud-init-jenkins.txt and paste the following configuration. For example, create the file in the Cloud Shell not on your local machine. Enter sensible-editor cloud-init-jenkins.txt
to create the file and see a list of available editors. Make sure that the whole cloud-init file is copied correctly, especially the first line:
Before you can create a VM, create a resource group with az group create. The following example creates a resource group named myResourceGroupJenkins in the eastus location:
Now create a VM with az vm create. Use the --custom-data
parameter to pass in your cloud-init config file. Provide the full path to cloud-init-jenkins.txt if you saved the file outside of your present working directory.
It takes a few minutes for the VM to be created and configured.
To allow web traffic to reach your VM, use az vm open-port to open port 8080 for Jenkins traffic and port 1337 for the Node.js app that is used to run a sample app:
Configure Jenkins
To access your Jenkins instance, obtain the public IP address of your VM:
For security purposes, you need to enter the initial admin password that is stored in a text file on your VM to start the Jenkins install. Use the public IP address obtained in the previous step to SSH to your VM:
Verify Jenkins is running using the service
command:
View the initialAdminPassword
for your Jenkins install and copy it:
If the file isn't available yet, wait a couple more minutes for cloud-init to complete the Jenkins and Docker install.
Now open a web browser and go to http://<publicIps>:8080
. Complete the initial Jenkins setup as follows:
- Choose Select plug-ins to install
- Search for GitHub in the text box across the top. Check the box for GitHub, then select Install
- Create the first admin user. Enter a username, such as admin, then provide your own secure password. Finally, type a full name and e-mail address.
- Select Save and Finish
- Once Jenkins is ready, select Start using Jenkins
- If your web browser displays a blank page when you start using Jenkins, restart the Jenkins service. From your SSH session, type
sudo service jenkins restart
, then refresh you web browser.
- If your web browser displays a blank page when you start using Jenkins, restart the Jenkins service. From your SSH session, type
- If needed, log in to Jenkins with the username and password you created.
Create GitHub webhook
To configure the integration with GitHub, open the Node.js Hello World sample app from the Azure samples repo. To fork the repo to your own GitHub account, select the Fork button in the top right-hand corner.
Create a webhook inside the fork you created:
- Select Settings, then select Webhooks on the left-hand side.
- Choose Add webhook, then enter Jenkins in filter box.
- For the Payload URL, enter
http://<publicIps>:8080/github-webhook/
. Make sure you include the trailing / - For Content type, select application/x-www-form-urlencoded.
- For Which events would you like to trigger this webhook?, select Just the push event.
- Set Active to checked.
- Click Add webhook.
Create Jenkins job
To have Jenkins respond to an event in GitHub such as committing code, create a Jenkins job. Use the URLs for your own GitHub fork.
In your Jenkins website, select Create new jobs from the home page:
- Enter HelloWorld as job name. Choose Freestyle project, then select OK.
- Under the General section, select GitHub project and enter your forked repo URL, such as
https://github.com/cynthn/nodejs-docs-hello-world
- Under the Source code management section, select Git, enter your forked repo .git URL, such as
https://github.com/cynthn/nodejs-docs-hello-world.git
- Under the Build Triggers section, select GitHub hook trigger for GITscm polling.
- Under the Build section, choose Add build step. Select Execute shell, then enter
echo 'Test'
in the command window. - Select Save at the bottom of the jobs window.
Test GitHub integration
To test the GitHub integration with Jenkins, commit a change in your fork.
Back in GitHub web UI, select your forked repo, and then select the index.js file. Select the pencil icon to edit this file so line 6 reads:
To commit your changes, select the Commit changes button at the bottom.
In Jenkins, a new build starts under the Build history section of the bottom left-hand corner of your job page. Choose the build number link and select Console output on the left-hand side. You can view the steps Jenkins takes as your code is pulled from GitHub and the build action outputs the message Test
to the console. Each time a commit is made in GitHub, the webhook reaches out to Jenkins and triggers a new build in this way.
Define Docker build image
To see the Node.js app running based on your GitHub commits, lets build a Docker image to run the app. The image is built from a Dockerfile that defines how to configure the container that runs the app.
From the SSH connection to your VM, change to the Jenkins workspace directory named after the job you created in a previous step. In this example, that was named HelloWorld.
Create a file in this workspace directory with sudo sensible-editor Dockerfile
and paste the following contents. Make sure that the whole Dockerfile is copied correctly, especially the first line:
This Dockerfile uses the base Node.js image using Alpine Linux, exposes port 1337 that the Hello World app runs on, then copies the app files and initializes it.
Create Jenkins build rules
In a previous step, you created a basic Jenkins build rule that output a message to the console. Lets create the build step to use our Dockerfile and run the app.
Back in your Jenkins instance, select the job you created in a previous step. Select Configure on the left-hand side and scroll down to the Build section:
Remove your existing
echo 'Test'
build step. Select the red cross on the top right-hand corner of the existing build step box.Choose Add build step, then select Execute shell
In the Command box, enter the following Docker commands, then select Save:
The Docker build steps create an image and tag it with the Jenkins build number so you can maintain a history of images. Any existing containers running the app are stopped and then removed. A new container is then started using the image and runs your Node.js app based on the latest commits in GitHub.
Test your pipeline
To see the whole pipeline in action, edit the index.js file in your forked GitHub repo again and select Commit change. A new job starts in Jenkins based on the webhook for GitHub. It takes a few seconds to create the Docker image and start your app in a new container.
If needed, obtain the public IP address of your VM again:
Open a web browser and enter http://<publicIps>:1337
. Your Node.js app is displayed and reflects the latest commits in your GitHub fork as follows:
Now make another edit to the index.js file in GitHub and commit the change. Wait a few seconds for the job to complete in Jenkins, then refresh your web browser to see the updated version of your app running in a new container as follows:
Next steps
In this tutorial, you configured GitHub to run a Jenkins build job on each code commit and then deploy a Docker container to test your app. You learned how to:
- Create a Jenkins VM
- Install and configure Jenkins
- Create webhook integration between GitHub and Jenkins
- Create and trigger Jenkins build jobs from GitHub commits
- Create a Docker image for your app
- Verify GitHub commits build new Docker image and updates running app
Advance to the next tutorial to learn more about how to integrate Jenkins with Azure DevOps Services.
This tutorial explains, how to install docker on EC2 Instance. Before starting, let’s have some brief knowledge about Docker.
Docker is a platform that combines applications and its dependencies in the form of packages, called container. We can run multiple containers on a single Operating System. Containers are not Virtual Machines. Virtual Machines requires Operating System to run applications, but containers do not. As containers don’t need an Operating System, it takes very little time to start and hence it is very faster than Virtual Machines.
- Install Docker Compose on RHEL 8 / CentOS 8. Follow our separate guide on installation of latest Docker Compose on Linux. Install Docker Compose on Linux. For the sake of keeping this guide brief, we won’t dive into Docker compose usage. I’ll recommend you go through Official Docker documentation and Docker Compose documentation to learn more.
- This is very similar to the technique described by Pini Reznik in Continuous Delivery with Docker on Mesos In Less than a Minute, but we're going to use sudo to avoid the issues Pini faced with adding the user to the Docker group. We'll be using the official Jenkins image as a base, which makes everything pretty straightforward.
Also Learn: How to install Ansible on Amazon Linux(EC2 )
and Launching Amazon Linux EC2 Instance
We're going through the steps to install Jenkins using Docker-Compose. Install Docker Compose Docker Desktop for Mac and Docker Toolbox already include Compose along with other Docker apps, so Mac users do not need to install Compose separately.
Let’s Install Docker on EC2 Instance
In this tutorial, we will use Amazon Linux to install docker. Amazon Linux/Amazon Linux2 is the Linux Operating System used in EC2 Instance.
Step 1– Log to Linux EC2 Instance and update it.
$ sudo yum update -y
Step 2– Install docker using Yum command
$ sudo yum install docker -y
Step 3– Start Docker Service
$ Service docker start
Step 4– Check docker Version.
$ docker -v
Basic Configuration (Creating Docker File / Running Docker Image)
Docker Jenkins Install In Chrome
After you install docker on ec2 , let’s have some basic setup for Docker.

Step 1 – Create a docker file
Dockerfile is a text file where we write instructions to build an image.
Create a folder name Images on the Amazon Linux box.
$ mkdir images
Install Jenkins With Docker Compose
Move to folder images
$ cd images
Create a file name Dockerfile inside images folder
$ nano Dockerfile
Put the content in the following way inside the Dockerfile.
FROM Ubuntu ( It will use the Official image Ubuntu to build your image)
MAINTAINER chandan <[email protected]>
( It sets the Author field of the generated image)
RUN apt-get update ( It will update the image at the time of Build)
CMD [ “echo”, ” Hello World ……….! “] ( It will run echo command when we run the docker container image)
Please also readHow to install docker on ec2 Instance(Windows)
You may also likeInstall Docker on Ubuntu using Script
Step 2– Run the docker build command to build the image.
$ docker build .
Note : ( . command is used when you are inside images folder where Dockerfile is present, alternatively you can put the docker file absolute path like /home/ec2-user/images/Dockerfile)
You can run the following command as well to Name and tag your Image. Here myimage is the Name and 01 is Tag of the image.
$ docker build -t myimage:01 .
Step 3– See the Docker Images after build
$ docker images
Step 4 – Run the docker image
$ docker run 07deaa33585e
Here 07deaa33585e is the IMAGE ID that can be seen in docker images command.
You can see here, it executed the echo command as soon as we run the docker image. In the same way, we can run any script, commands or any application by running a docker image.
Install Jenkins Using Docker Compose
Click to tweet this tip !
I hope you enjoyed this tutorial and learned to install docker on ec2 instance (Amazon Linux). If you think this is really helpful, please do share this with others as well. Please also share your valuable feedback, comment or any query in the comment box. I will really happy to resolve your all queries anytime.
Thank You
If you think we helped you or just want to support us, please consider these:-
Connect to us: FacebookTwitter
Overview
This plugin allows containers to be dynamically provisioned as Jenkins nodes using Docker. It is a Jenkins Cloud plugin for Docker.
The aim of this docker plugin is to be able to use a Docker host to dynamically provision a docker container as a Jenkins agent node, let that run a single build, then tear-down that node, without the build process (or Jenkins job definition) requiring any awareness of docker.


The Jenkins administrator configures Jenkins with knowledge of one or more docker hosts (or swarms), knowledge of one or more 'templates' (which describe the labels/tags that this template provides, the docker image, how to start it, etc) and Jenkins can then run docker containers to provide Jenkins (agent) Nodes on which Jenkins can run builds.
See also
- Support and contribution guide
Note: There is more than one docker plugin for Jenkins. While this can be confusing for end-users, it's even more confusing when end users report bugs in the wrong place. e.g. if you are using Jenkins pipeline / workflow / Jenkinsfile builds with code including terms like docker.withDockerRegistry
or docker.image
etc then you're using the docker-workflow
plugin and should go to its repository instead of this one.
Note: This plugin does not provide a Docker daemon; it allows Jenkins to use a docker daemon. i.e. Once you've installed docker on your OS, this plugin will allow Jenkins to use it.
A quick setup is :
- get a docker environment running
- follow the instructions for creating a docker image that can be used as a Jenkins Agent
Docker Environment
Follow the installation steps on the docker website.
If your Jenkins instance is not on the same OS as the docker install, you will need to open the docker TCP port so that Jenkins can communicate with the docker daemon. This can be achieved by editing the docker config file and setting (for example)
The docker configuration file location will depend your system, but it is likely to be /etc/init/docker.conf
, /etc/default/docker
or /etc/default/docker.io
.
Multiple Docker Hosts
If you want to use more than just one physical node to run containers, you can use Docker Swarm Standalone or you can define more than one docker 'cloud'. The docker engine swarm mode API is not supported (at present; enhancement contributions would be welcomed).
To use the standalone swarm, follow docker swarm standalone instructions and configure Jenkins with the swarm's API endpoint.
Jenkins Configuration
Docker plugin is a 'Cloud' implementation. You'll need to edit Jenkins system configuration (Jenkins -> Manage -> System configuration) and add a new Cloud of type 'Docker'.
Configure Docker (or Swarm standalone) API URL with required credentials. The test button lets you check the connection.
Then configure Agent templates, assigning them labels that you can use so your jobs select the appropriate template, and set the docker container to be run with whatever container settings you require.
Creating a docker image
Install Jenkins Using Docker
You need a docker image that can be used to run Jenkins agent runtime. Depending on the launch method you select, there's some prerequisites for the Docker image to be used:
Launch via SSH
- sshd server and a JDK installed. You can use jenkins/ssh-agent as a basis for a custom image.
- a SSH key (based on unique Jenkins master instance identity) can be injected in container on startup, you don't need any credential set as long as you use standard openssl sshd.
For backward compatibility or non-standard sshd packaged in your docker image, you also have option to provide manually configured ssh credentials - Note: If the docker container's host SSH key is not trusted by Jenkins (usually the case) then you'll need to set the SSH host key verification method to 'non-verifying'.
Launch via JNLP
Setup Jenkins With Docker Compose
- a JDK installed. You can use jenkins/inbound-agent as a basis for a custom image.
- Jenkins master URL has to be reachable from container.
- container will be configured automatically with agent's name and secret, so you don't need any special configuration of the container.
Launch attached
Docker Jenkins Installation
- a JDK installed. You can use jenkins/agent as a basis for a custom image.
To create a custom image and bundle your favorite tools, create a Dockerfile
with the FROM
to point to one of the jenkins/*-agent reference images, and install everything needed for your own usage, e.g.
Install Jenkins Using Docker Ubuntu
Note on ENTRYPOINT
Avoid overriding the docker command, as the SSH Launcher relies on it.
Docker Jenkins Install Ubuntu
You can use an Entrypoint to run some side service inside your build agent container before the agent runtime starts and establish a connection ... but you MUST ensure your entrypoint eventually runs the passed command:
Further information
More information can be obtained from the online help built into the Jenkins WebUI. Most configurable fields have explanatory text. This, combined with knowledge of docker itself, should answer most questions.
Docker Jenkins Install Python
Jenkins can be configured using Groovy code, and the docker plugin is no exception. For example, this configuration script could be run automatically upon Jenkins post-initialization or through the Jenkins script console. If run, this script will configure the docker-plugin to look for a docker daemon running within the same OS as the Jenkins master (connecting to Docker service through unix:///var/run/docker.sock
) and with the containers connecting to Jenkins using the 'attach' method.