New container each time
$> docker run -it --rm --name [containername] \
-v "$PWD":/usr/src/mavenproject -w /usr/src/mavenproject maven:3.3 mvn clean package
Keep container and maven local repository cache (no --rm)
docker run -it --name [containername] -v "$PWD":/usr/src/mavenproject -w /usr/src/mavenproject maven:3.3
Mount local repository
docker run -it --rm -v "$PWD":/usr/src/myweb -v "/Users/teman/.m2":/root/.m2 -w /usr/src/myweb maven:3.3 mvn clean package
Access shell
- docker start [containername]
- docker exec -it [containername] mvn clean package
Reference
- https://hub.docker.com/_/maven/
沒有留言:
張貼留言