How to Run Latest Jenkins in a Docker Container

This tutorial will guide you through the steps for setting up jenkins in a docker container.

  1. Command to run Jenkins with the host volume mapped to the container for jenkins data.

    docker run --name yourjenkins -p 8080:8080 -p 50000:50000 -v /your/home:/var/jenkins_home jenkins

    Change /your/home with your Linux host directory for mapping containers jenkins_hom directory. This would persist data your host rather than the containers. Even if container crashes, your data will not be lost.

    The above command would set up the latest jenkins installation.

  2. If you want a specific jenkins version, head over to jenkins docker. Jenkins Docker Hub to get the details about the latest docker builds for jenkins from the tags option.