Skip to content

Instantly share code, notes, and snippets.

@bsharathchand
bsharathchand / building-maven-project-in-containers.md
Last active August 16, 2018 01:57
Building maven projects in docker containers

Building maven project in docker

> cd $GIT_HOME/projects/demo # navigate to project directory
> docker run --it --rm --name build -v $(PWD):/project -v $M2_HOME/.m2:/root/.m2 -w /project maven:3-jdk-7 mvn clean install

Anotomy of the docker run command

  • --it keeps the STDIN open and allocates a psuedo tty
  • --rm removes the container once the execution is complete
  • --name build assigns a name to the container