I am trying to create a simple web application with Maven and work with Tomcat7 inside the Docker container.
This is my structure:
- Dockerfile - pom.xml - src/main/webapp/index.hmtl
This is my Docker file:
FROM java:8 # Install maven RUN apt-get -y update && apt-get install -y maven WORKDIR /code # Prepare by downloading dependencies ADD pom.xml /code/pom.xml # Adding source, compile and package into a fat jar ADD src /code/src RUN ["mvn", "package"] EXPOSE 8080 CMD ["mvn", "tomcat7:run"]
I am creating a docker image using
docker build -t webapp-example .
and try running it with
docker run -d -p 8080:8080 webapp-example
But apparently this will not work.
Any ideas?
source share