docker run
--name jenkins
-p 8080:8080
-p 50000:50000
-v jenkins_home:/var/jenkins_home
-d
-v /var/run/docker.sock:/var/run/docker.sock
-v $(which docker):/usr/bin/docker
jenkins/jenkins:jdk17-preview
# Get the Jenkins Docker Image and Jenkins is now running on port 8080
docker run -d -v jenkins_home:/var/jenkins_home -p 8080:8080 -p 50000:50000 --restart=on-failure jenkins/jenkins:lts-jdk11
# You'll need the admin password
docker ps -a # copy the container_id
docker exec -it {container_id} /bin/bash
cat /var/jenkins_home/secrets/initialAdminPassword
docker run -d -v jenkins_home:/var/jenkins_home -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts-jdk11
docker run -p 8080:8080 -p 50000:50000 -v ~/jenkins_home:/var/jenkins_home jenkins/jenkins:lts
docker run --name jenkins-docker --rm --detach
--privileged --network jenkins --network-alias docker
--env DOCKER_TLS_CERTDIR=/certs
--volume jenkins-docker-certs:/certs/client
--volume jenkins-data:/var/jenkins_home
--publish 2376:2376
docker:dind --storage-driver overlay2
pipeline {
agent { label 'master' }
stages {
stage('build') {
steps {
script {
def disk_size = sh(script: "df / --output=avail | tail -1", returnStdout: true).trim() as Integer
println("disk_size = ${disk_size}")
}
}
}
}
}
docker run
--name jenkins-docker (1)
--rm (2)
--detach (3)
--privileged (4)
--network jenkins (5)
--network-alias docker (6)
--env DOCKER_TLS_CERTDIR=/certs (7)
--volume jenkins-docker-certs:/certs/client (8)
--volume jenkins-data:/var/jenkins_home (9)
--publish 2376:2376 (10)
docker:dind (11)
--storage-driver overlay2(12)