简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM