Skip to content

Instantly share code, notes, and snippets.

@nunogt
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save nunogt/ce74d02924b05be9857d to your computer and use it in GitHub Desktop.

Select an option

Save nunogt/ce74d02924b05be9857d to your computer and use it in GitHub Desktop.
Debian Jessie Apache Tomcat 7 Dockerfile
FROM debian:jessie
MAINTAINER Nuno Taborda <@nunogt>
# Update the system
RUN apt-get update && apt-get -y upgrade
# Install openjdk and tomcat
RUN apt-get install -y openjdk-7-jre-headless tomcat7 libtcnative-1
# Patch init for start-stop-daemon not to require /proc scanning
RUN sed -i s,--exec,--startas,g /etc/init.d/tomcat7
# Cleanup
RUN apt-get clean -y
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Export Java environment variables
ENV JRE_HOME /usr/lib/jvm/java-7-openjdk-amd64
ENV JAVA_OPTS -Djava.awt.headless=true -server
# Tell Docker we're exposing this port
EXPOSE 8080
# Bootstrap Tomcat and never return
CMD /etc/init.d/tomcat7 start && sleep infinity
@nunogt
Copy link
Author

nunogt commented Jun 19, 2015

Build as follows:

git clone https://gist.github.com/ce74d02924b05be9857d.git
cd ce74d02924b05be9857d
docker build -t nunogt/tomcat7 .

Then run:

docker run -dt -P nunogt/tomcat7

Check host port mappings:

docker ps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment