Jenkins installation on Docker
Create an container and run it from the Community edition image
docker run -d \
--name jenkins \
-p 8081:8080 \
-p 50000:50000 \
-v jenkins_home:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkins/jenkins:lts
Docker - Bind mount on Windows mounting JENKINS_HOME to a local directory (in our example to D:\jenkins_home)
# The jenkins home
mkdir D:\jenkins_home
# Just to send data
mkdir D:\backup
cd /D D:\jenkins_home
docker run -d ^
--name jenkins ^
-p 8081:8080 ^
-p 50000:50000 ^
-v %cd%:/var/jenkins_home ^
-v d:\backup:/backup ^
-v /var/run/docker.sock:/var/run/docker.sock ^
--env JAVA_OPTS="-Dmail.smtp.starttls.enable=true" ^
--restart always ^
jenkins/jenkins:lts
where:
docker logs jenkins
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:
7ab9314d864540bcb474d35fe56943eb
This may also be found at: /var/jenkins_home/secrets/initialAdminPassword
HTTP - Gateway (Reverse Proxy)
Install the tools
Manage Jenkins > Global Tools Configuration:
docker exec -it jenkins bash
which java
# /opt/java/openjdk
cd $ANT_HOME
ant -f fetch.xml -Ddest=system
docker run \
--name jenkins \
-u root \
-p 8080:8080 \
-v jenkins-data:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$HOME":/home \
jenkinsci/blueocean