FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

eduanb/docker-maven-example: Example for creating and running Docker containers using maven · GitHub

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maven dockerfile example

Using local maven:mvn <goal>

Using maven in docker: docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v "$(pwd)":/usr/src/example -w /usr/src/example maven:3.6.1-jdk-8 mvn <goal>

Note1: Since this is creating containers and interacting with Docker, the docker.sock is required, Note2: This will download a lot of maven dependencies every time. It is recommended to mount the repository.

To create a volume: docker volume create --name maven-repo

Then: docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v maven-repo:/root/.m2 -v "$(pwd)":/usr/src/example -w /usr/src/example maven:3.6.1-jdk-8 mvn <goal>

Otherwise, the default maven location is ~/.m2

docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v ~/.m2:/root/.m2 -v "$(pwd)":/usr/src/example -w /usr/src/example maven:3.6.1-jdk-8 mvn <goal>

The available goals are:

package: build the containers

For more info on the maven container: https://hub.docker.com/_/maven

For more info on the Docker plugin: https://maven.fabric8.io/

About

Example for creating and running Docker containers using maven

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages


Back | FazBrowse Home | New Git URL