Skip to content

Instantly share code, notes, and snippets.

@J00MZ
Created February 3, 2019 18:40
Show Gist options
  • Save J00MZ/a34a3bbf80bf0b8ae66b183e627679bf to your computer and use it in GitHub Desktop.
Save J00MZ/a34a3bbf80bf0b8ae66b183e627679bf to your computer and use it in GitHub Desktop.
Jenkins as Docker image
# Variables
HOST_PATH="/data/jenkins_master"
CONTAINER_PATH="/var/jenkins_home"
JENKINS_DOCKER_IMAGE="jenkins/jenkins"
HTTP_PORT="-1" # disables http
JNLP_PORT="50000"
SSL_PORT="443"
CONT_HTTPS_PORT="8443"
SSH_SERVER_PORT="43387"
KEY_STORE="/var/jenkins_home/.keystore/cacerts.jks"
KEY_STORE_PW="<YOUR_PASSWORD>"
# Flow
docker run -t -d --name ${JENKINS_CONT_NAME} -v ${HOST_PATH}:${CONTAINER_PATH} -p ${SSL_PORT}:${CONT_HTTPS_PORT} -p ${JNLP_PORT}:${JNLP_PORT} -p ${SSH_SERVER_PORT}:${SSH_SERVER_PORT} --restart always ${JENKINS_DOCKER_IMAGE} --httpPort=${HTTP_PORT} --httpsPort=${CONT_HTTPS_PORT} --httpsKeyStore=${KEY_STORE} --httpsKeyStorePassword=${KEY_STORE_PW}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment