docker run -u root --rm -d -p 8080:8080 -p 50000:50000 --name jenkins-kim -v /Users/mikael/Volume/Jenkins:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock jenkinsci/blueocean
Get Admin Password
docker exec jenkins-kim cat /var/jenkins_home/secrets/initialAdminPassword
--rm
is to remove the docker container after it is shut down.
-d
is to let jenkinsci container run in background and silent the output rather than print out in terminal console. Recommend not to add this option, because usually you want to check the output from terminal console, e.g. the initial password.
-p 8080:8080
is the to map the port number for host machine and docker container respectively.
-p 50000:50000
is for the JNLP based Jenkins master-slave configurations. JNLP-based Jenkins agents communicate with the Jenkins master through TCP port 50000 by default.
-v jenkins-data:/var/jenkins_home
is to map the /var/jenkins_home directory in the container to the Docker volume with the name jenkins-data, this option is to ask Jenkins to persist state for instance restarts. -v /var/run/docker.sock:/var/run/docker.sock, this option is to allow jenkins ci container to communicate with docker daemon. jenkinsci/blueocean is the jenkinsci image with blueocean plugin, specifying this option will automatically pull any updates.