Description
I'm writing a simple console application that starts in a Docker container, reads user input and processes it. For automating Docker I use docker-maven-plugin. The code for reading user input is the following:
new Scanner(System.in).nextLine()
Tried also the following:
new BufferedReader(new InputStreamReader(System.in)).readLine()
Running an application without Docker works in both cases.
I run the docker with command:
mvn clean docker:build docker:run
However in Docker when it comes to user input the code simply returns null
and doesn't block for user input. In case of Scanner
I get java.util.NoSuchElementException: No line found
which is basically the same.
I've found a similar issue on StackOverflow where passing the command line parameters -i -t
seem to help.
Is there any way I could add these command line parameters to Maven
run configuration? Or any ideas why this issue happens?
Info
- Maven version : 3.3.9
- Docker version : 1.13.1