Vert.x - Docker

Java Conceptuel Diagram

About

Docker as a distribution unit to distribute an run a vert.x application

Type

Bare

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:

Vertx 3

See https://vertx.io/docs/vertx-docker/

Create your image

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/*"]

Run

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 

Vertx4

https://how-to.vertx.io/executable-jar-docker-howto/





Discover More
Java Conceptuel Diagram
Vert.x - Distribution

The vert.x distribution is available as archive file or as docker A full distribution contains: the vertx client and all the vertx library
Java Conceptuel Diagram
Vert.x - The launcher run command

The run command (Code) is a command of the launcher. It will: create a instance...
Vertx Verticle And Lib
Vertx - Distribution Deployment

Distribution deployment is the deployment of a verticle that is based on the availability of a vertx distribution Get the Vert.x distribution Create a distribution of your application that contains:...



Share this page:
Follow us:
Task Runner