Ram
Ram

Reputation: 373

Spring Shell appilication inside docker

I am trying to deploy/run a spring shell application inside a docker container. It is starting but filing when tries to open CLI.

2018-07-20 19:24:44.588  INFO 1 --- [           main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-07-20 19:24:44.597 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.io.IOError: java.io.IOException: Unable to parse columns
        at org.jline.terminal.impl.AbstractPosixTerminal.getSize(AbstractPosixTerminal.java:61) ~[jline-3.4.0.jar!/:na]
        at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:481) ~[jline-3.4.0.jar!/:na]
        at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:390) ~[jline-3.4.0.jar!/:na]
        at org.springframework.shell.jline.InteractiveShellApplicationRunner$JLineInputProvider.readInput(InteractiveShellApplicationRunner.java:115) ~[spring-shell-core-2.0.0.RELEASE.jar!/:2.0.0.RELEASE]
        at org.springframework.shell.Shell.run(Shell.java:125) ~[spring-shell-core-2.0.0.RELEASE.jar!/:2.0.0.RELEASE]
        at org.springframework.shell.jline.InteractiveShellApplicationRunner.run(InteractiveShellApplicationRunner.java:84) ~[spring-shell-core-2.0.0.RELEASE.jar!/:2.0.0.RELEASE]
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:788) [spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
        at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:778) [spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) [spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
        at com.robustwealth.simulator.RwFixEngineApplication.main(RwFixEngineApplication.java:14) [classes!/:0.0.1-SNAPSHOT]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [app.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [app.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [app.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [app.jar:0.0.1-SNAPSHOT]
Caused by: java.io.IOException: Unable to parse columns
        at org.jline.terminal.impl.ExecPty.doGetInt(ExecPty.java:278) ~[jline-3.4.0.jar!/:na]
        at org.jline.terminal.impl.ExecPty.doGetSize(ExecPty.java:263) ~[jline-3.4.0.jar!/:na]
        at org.jline.terminal.impl.ExecPty.getSize(ExecPty.java:170) ~[jline-3.4.0.jar!/:na]
        at org.jline.terminal.impl.AbstractPosixTerminal.getSize(AbstractPosixTerminal.java:59) ~[jline-3.4.0.jar!/:na]

This might be because it is not able to fine any terminal inside docker. How can we overcome this ?

docker file

FROM frolvlad/alpine-oraclejdk8:slim
VOLUME /tmp
ADD simulator-0.0.1-SNAPSHOT.jar app.jar
RUN sh -c 'touch /app.jar'
ENV JAVA_OPTS=""
EXPOSE 5432
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -Dspring.profiles.active=uat -jar /app.jar" ]

Upvotes: 4

Views: 2880

Answers (1)

MrBit Fly
MrBit Fly

Reputation: 81

I run the container with the -t option to skip the error. And if you want to interact with the container, use -it.

Compile the image

$ docker build -f Dockerfile -t my-spring-shell-image .

See the image registry

$ docker images

Run the image !!

$ docker run -t -p 5432:5432 my-spring-shell-image

If you want access to the terminal you must type

$ docker run -it -p 5432:5432 my-spring-shell-image

Upvotes: 5

Related Questions