Damage to Vert.x-based application on docker container

I am trying to run a Vert.x Java application on a Docker container. My application runs several vertices that it initiates within itself. I put the jar file in a folder and created a Docker file with the following contents:

FROM vertx/vertx3
ENV VERTICLE_FILE Medical-1.0-SNAPSHOT.jar 
ENV VERTICLE_HOME /performit/web/vertx/verticles/
COPY $VERTICLE_FILE $VERTICLE_HOME/  
WORKDIR $VERTICLE_HOME
ENTRYPOINT ["sh", "-c"]
EXPOSE 8080
CMD ["java -jar $VERTICLE_FILE"]
USER daemon

I create an image using the command

$ sudo docker build -t medical-main .

Then I try to create a container with the following line:

sudo docker run --name medical-main -p 8080:8080 -d  medical-main

This fails and the log shows the following:

java.lang.IllegalStateException: Failed to create cache dir
at io.vertx.core.impl.FileResolver.setupCacheDir(FileResolver.java:257)
at io.vertx.core.impl.FileResolver.<init>(FileResolver.java:79)
at io.vertx.core.impl.VertxImpl.<init>(VertxImpl.java:138)
at io.vertx.core.impl.VertxImpl.<init>(VertxImpl.java:114)
at io.vertx.core.impl.VertxImpl.<init>(VertxImpl.java:110)
at io.vertx.core.impl.VertxFactoryImpl.vertx(VertxFactoryImpl.java:34)
at io.vertx.core.Vertx.vertx(Vertx.java:79)

What am I missing?

Itzgar

+6
source share
5 answers

FileResolver.java, vert.x ".vertx" . , "daemon", , ? , , docker-image-author-guidance, root.

+8

, jar (, -, ). , , vertx.disableFileCPResolving true. , vertx.cacheDirBase.

: https://groups.google.com/forum/#!topic/vertx/7cBbKrjYfeI

+4

, Vert.x .vertx (cache dir), classpath , classpath. , $user .

dir : jar . , , Vert.x . .

vertx run my.Verticle -Dvertx.cacheDirBase=/tmp/vertx-cache
# or
java -jar my-fat.jar -Dvertx.cacheDirBase=/tmp/vertx-cache

, -Dvertx.disableFileCaching=true. Vert.x - , , , . , , classpath, , Vert.x classpath, . , .

+3

vert.x -dir (.vertx/file-cache-someuuid) . , mkdirs() . workdir?

0

JAR. , jar ROOT, , , .

, jar SUDO .vertx ROOT.

, ll alias Amazon Linux, , ,

, , ls -al .vertx, , SUDO.

The remote .vertx folder and jar file started working normally again as a regular user.

0
source

All Articles