The latest Docker images allows building custom images with additonal Maven dependencies added to the platform’s libs.
The typical Dockerfile for building these custom images is this one: Dockerfile-add-custom-dependencies. That you can use like this:
docker build \
-f Dockerfile-add-custom-dependencies \
-t <my custom image> \
--build-arg tag=<tag> \
--build-arg deps="<my dependencies>" .
Where <tag> is the tag of the chosen base image (e.g. 5-latest) and <my dependencies> is a list of dependencies in the following format <group ID>:<artifact ID>:<version> (e.g. net.sf.trove4j:trove4j:3.0.3)
Note that the already existing libs (including when in different versions) are ignored