Docker as a distribution unit to distribute an run a vert.x application
Example:
docker run \
--name "vertx" \
-it \
--rm \
-p 8081:8080 \
-v $PWD/build/libs:/app \
anapsix/alpine-java \
java -jar vertx-application-fat.jar
where:
See https://vertx.io/docs/vertx-docker/
From the base image vertx3
Example of Dockerfile for java:
# Extend vert.x image
FROM vertx/vertx3
#
ENV VERTICLE_NAME io.vertx.sample.hello.HelloVerticle
ENV VERTICLE_FILE target/hello-verticle-1.0-SNAPSHOT.jar
# Set the location of the verticles
ENV VERTICLE_HOME /usr/verticles
EXPOSE 8080
# Copy your verticle to the container
COPY $VERTICLE_FILE $VERTICLE_HOME/
# Launch the verticle
WORKDIR $VERTICLE_HOME
ENTRYPOINT ["sh", "-c"]
CMD ["exec vertx run $VERTICLE_NAME -cp $VERTICLE_HOME/*"]
Exec a verticle with the vertx3-exec image
It will start the run command
docker run -i -t -p 8080:8080 \
-v $PWD:/verticles vertx/vertx3-exec \
run io.vertx.sample.RandomGeneratorVerticle \
-cp /verticles/MY_VERTICLE.jar
https://how-to.vertx.io/executable-jar-docker-howto/