Jenkins on Docker notes
Published (last updated )
docker run --detach --rm --env HTTP_PROXY=http://10.10.10.1:3128 --env HTTPS_PROXY=http://10.10.10.1:3128 --env http_proxy=http://10.10.10.1:3128 --env https_proxy=http://10.10.10.1:3128 --env JAVA_OPTS="-Dhttp.proxyHost=10.10.10.1 -Dhttp.proxyPort=3128 -Dhttps.proxyHost=10.10.10.1 -Dhttps.proxyPort=3128" --publish 8080:8080 --publish 50000:50000 --name jenkins jenkins/jenkins:lts
Get list of plugins:
curl "http://admin:password@localhost:8080/pluginManager/api/xml?depth=1&xpath=/*/*/shortName|/*/*/version&wrapper=plugins" | perl -pe "s/.*?<shortName>([\w-]+).*?<version>([^<]+)()(<\/\w+>)+/\1 \2\n/g" | perl -pe "s| |:|g" | sort
Other stuff:
COPY ./contrib/openshift /opt/openshift
COPY ./contrib/jenkins /usr/local/bin
ADD ./contrib/s2i /usr/libexec/s2i
ADD release.version /tmp/release.version
RUN /usr/local/bin/install-plugins.sh /opt/openshift/base-plugins.txt && \
# need to create <plugin>.pinned files when upgrading "core" plugins like credentials or subversion that are bundled with the jenkins server
# Currently jenkins v2 does not embed any plugins, but for reference:
# touch /opt/openshift/plugins/credentials.jpi.pinned && \
rmdir /var/log/jenkins && \
chmod 664 /etc/passwd && \
chmod -R 775 /etc/alternatives && \
chmod -R 775 /var/lib/alternatives && \
chmod -R 775 /usr/lib/jvm && \
chmod 775 /usr/bin && \
chmod 775 /usr/lib/jvm-exports && \
chmod 775 /usr/share/man/man1 && \
chmod 775 /var/lib/origin && \
unlink /usr/bin/java && \
unlink /usr/bin/jjs && \
unlink /usr/bin/keytool && \
unlink /usr/bin/orbd && \
unlink /usr/bin/pack200 && \
unlink /usr/bin/policytool && \
unlink /usr/bin/rmid && \
unlink /usr/bin/rmiregistry && \
unlink /usr/bin/servertool && \
unlink /usr/bin/tnameserv && \
unlink /usr/bin/unpack200 && \
unlink /usr/lib/jvm-exports/jre && \
unlink /usr/share/man/man1/java.1.gz && \
unlink /usr/share/man/man1/jjs.1.gz && \
unlink /usr/share/man/man1/keytool.1.gz && \
unlink /usr/share/man/man1/orbd.1.gz && \
unlink /usr/share/man/man1/pack200.1.gz && \
unlink /usr/share/man/man1/policytool.1.gz && \
unlink /usr/share/man/man1/rmid.1.gz && \
unlink /usr/share/man/man1/rmiregistry.1.gz && \
unlink /usr/share/man/man1/servertool.1.gz && \
unlink /usr/share/man/man1/tnameserv.1.gz && \
unlink /usr/share/man/man1/unpack200.1.gz && \
chown -R 1001:0 /opt/openshift && \
/usr/local/bin/fix-permissions /opt/openshift && \
/usr/local/bin/fix-permissions /opt/openshift/configuration/init.groovy.d && \
/usr/local/bin/fix-permissions /var/lib/jenkins && \
/usr/local/bin/fix-permissions /var/log
VOLUME ["/var/jenkins_home"]