Jenkins cheatsheet
Jenkins: Running Jenkins
4 common Jenkins tasks.
Start Jenkins in Docker
Run the long-term-support image with a volume for its data. Open http://localhost:8080.
docker run -d --name jenkins -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts
Find the initial admin password
Read the unlock password from the container's logs or secrets file.
docker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword
Trigger a build from the command line
Use jenkins-cli.jar, downloaded from your Jenkins server, with a user and API token.
java -jar jenkins-cli.jar -s http://localhost:8080/ -auth user:API_TOKEN build my-job -s -v
Install plugins in an image
Pre-install plugins when building a Jenkins image.
jenkins-plugin-cli --plugins git workflow-aggregator docker-workflow