All articles about Docker

How to Install Jenkins using Docker

Requirements:

  • Ubuntu Server Linux with Docker installed.

Tip: I have installed a virtual machine using the image: “ubuntu-18.04.2-live-server-amd64”.

You can download it from https://www.ubuntu.com/download/server

Jenkins Docker image:

Docker has a lot of images ready to use. For example, if you search on Google “docker jenkins image”:

You will find the official Docker website to download Jenkins image:

https://hub.docker.com/r/jenkins/jenkins/

And you can see the instruction to deploy the image in your Docker environment (:lts for latest version):

docker pull jenkins/jenkins:lts

This is only an example to understand how Docker images work.

Deploy Jenkins Docker image:

These are the commands to deploy a Jenkins image and run it as a container:

# Deploy Jenkins image
robermb@ubuntu:~$ sudo docker pull jenkins/jenkins:lts

# List current images
robermb@ubuntu:~$ sudo docker images

# Run a container using Jenkins image.
# Note: this will automatically create a 'jenkins_home' docker volume on the host machine, that will survive the container stop/restart/deletion.
robermb@ubuntu:~$ sudo docker run -d --name=jenkins_master -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts

To see if your container is running you can execute the following:

robermb@ubuntu:~$ sudo docker ps
Continue reading How to Install Jenkins using Docker
Compartir: