Skip to content

Instantly share code, notes, and snippets.

@ThabetAmer
Last active January 30, 2020 08:12
Show Gist options
  • Save ThabetAmer/b955de533c2ae955307713decf627fdb to your computer and use it in GitHub Desktop.
Save ThabetAmer/b955de533c2ae955307713decf627fdb to your computer and use it in GitHub Desktop.
Runs Jenkins in Docker
#! /bin/bash
# Runs Jnekins in Docker container.
# TODO: auto add plugins and default configs.
# Logs customization from https://hub.docker.com/_/jenkins/
mkdir data
cat > data/log.properties <<EOF
handlers=java.util.logging.ConsoleHandler
jenkins.level=FINEST
java.util.logging.ConsoleHandler.level=FINEST
EOF
chown 1000 data
docker run -d \
--name jenkins \
-p 8080:8080 -p 50000:50000 \
-v `pwd`/data:/var/jenkins_home \
--env JAVA_OPTS="-Djava.util.logging.config.file=/var/jenkins_home/log.properties -Xmx1024m -Duser.timezone=Asia/Jerusalem -Dhudson.footerURL=http://myurl.com" \
jenkins/jenkins:lts
# To read it's login password
docker logs jenkins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment