Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run maven command from docker image

I am building a docker image inside gitlab runner. So, I am using docker:latest image, because I need to push the image to the registry, but before building the image, I need to package my java project. How to use docker image with maven to build project?

Right now, gitlab runner returns an error

$ docker run -it --rm -v "$(pwd)":/opt/maven -w /opt/maven maven:3.3.9-jdk-8 mvn clean install
the input device is not a TTY
ERROR: Job failed: exit code 1
like image 905
B.Zamalutdinov Avatar asked Feb 27 '26 05:02

B.Zamalutdinov


1 Answers

You don't need (and cannot) run the container as interactive nor allocate a TTY there in Gitlab. So remove the -it from your docker run:

docker run --rm -v "$(pwd)":/opt/maven -w /opt/maven maven:3.3.9-jdk-8 mvn clean install
like image 95
Robert Avatar answered Mar 01 '26 18:03

Robert