Docker image for Karaf based on CentOS and OpenJDK 11.
@see on GitHub
Run Karaf in foreground:
docker run --rm -it spalarus/karaf /opt/karaf/bin/karaf
Following command creates a karaf-container with features scr and webconsole.
docker run --rm -it -e KARAF_INIT_COMMANDS="feature:install scr; feature:install webconsole;" spalarus/karaf /opt/karaf/bin/karaf
After container-start a background process connects to karaf instance and invokes the commands defined in variable KARAF_INIT_COMMANDS. The installation process starts 10 seconds after container creation.
docker run --rm -it -v /home/karaf/volume:/opt/karaf/vol spalarus/karaf /opt/karaf/bin/karaf
The karaf commands for feature installation can provided in file /bin/initcommands. The installation process starts 10 seconds after container creation.
echo "feature:install scr; feature:install webconsole;" > /home/karaf/volume/bin/initcommands
docker run --rm -it -v /home/karaf/volume:/opt/karaf/vol spalarus/karaf /opt/karaf/bin/karaf
The script does not continue, if one of karaf-shell-script-commands fails!
docker run -d --name karaffe -v /home/karaf/volume:/opt/karaf/vol spalarus/karaf
docker exec -it karaffe /opt/karaf/bin/client
Configuration files can move to volume. File updates survive container recreation, if volume directory is mounted to host.
An Example: To persist the file user.properties use following command:
docker exec -it karaffe /opt/karaf/bin/touchvoletc users.properties
The command above copies this file user.properties into the volume directory and creates a soft link from etc directory to vol directory.
It is possible to provide configuration files in /etc/ manually. On container recreation or container restart a script checks this directory and links the newly provided configuration files. To invoke this check in running karaf container on demand, please use following command:
docker exec -it karaffe /opt/karaf/bin/checkvoletc
Content type
Image
Digest
Size
234.6 MB
Last updated
almost 6 years ago
docker pull spalarus/karaf