Docker for java developement

Hey there, I’m a beginner in Docker and i want to run a Java application in a docker container, I’m trying to install maven in my dockerfile, but when i press docker build -t username/name_of_app, I get an error : ( E: Unable to locate package maven
INFO[0004] The command [/bin/sh -c apt-get install maven] returned a non-zero code: 100 )

I don’t know how to solve this :frowning:

Any ideas are welcome :slight_smile:

Please have a look over this official repo for maven:

Thank you @sbasyal for your reply, I changed my dockerfile following the link you sent to me but I still get the same Error :’(

I just tried and it is working. This is my Dockerfile

FROM maven:3

ADD pom.xml /home/pom.xml

And this is my test pom.xml file I place in the same location as above Dockerfile:

<project xmlns="" xmlns:xsi=""
  <name>Maven Quick Start Archetype</name>

Your test folder would look like this:

   |__ Dockerfile
   |__ pom.xml

Now, go to test and do docker build -t mvn-test .
Then, finally do docker run -P mvn-test:latest mvn package

Thank you so much @sbasyal :slight_smile: It works