This tutorial will guide you through the steps for setting up jenkins in a docker container.
-
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 containersjenkins_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.
-
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.