Karaf Docker image
4.0.10,4.0(4.0/Dockerfile)4.0.10-alpine,4.0-alpine(4.0-alpine/Dockerfile)4.1.5,4.1,4,latest(4.1/Dockerfile)4.1.5-alpine,4.1-alpine,4-alpine(4.1-alpine/Dockerfile)
Apache Karaf is a modern and polymorphic container powered by OSGi. Karaf can be used standalone as a container, supporting a wide range of applications and technologies. It also supports the "run anywhere" (on any machine with Java, cloud, docker images, …) using the embedded mode. It’s a lightweight, powerful, and enterprise ready platform. With this flexibility, Karaf is the perfect solution for microservices, systems integration, big data, and much more.
You can run container simply by
docker run --name some-karaf -d \
-p 1099:1099 \
-p 8101:8101 \
-p 44444:44444 hlavki/karafThe docker exec command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your karaf container:
docker exec -it some-karaf /opt/karaf/bin/clientThe Karaf container log is available through Docker's container log:
docker logs -f some-karafWhen you start the karaf image, you can adjust the configuration of the Karaf instance by passing one or more environment variables on the docker run command line.
JAVA_MIN_MEM- Minimum memory for the JVMJAVA_MAX_MEM- Maximum memory for the JVMJAVA_PERM_MEM- Minimum perm memory for the JVMJAVA_MAX_PERM_MEM- Maximum perm memory for the JVMEXTRA_JAVA_OPTS- Additional JVM optionsKARAF_DATA- Karaf data folderKARAF_OPTS- Additional available Karaf optionsKARAF_DEBUG- Enable debug modeKARAF_REDIRECT- Enable/set the std/err redirection when using bin/startKARAF_NOROOT- Prevent execution as root if set to true
You can map /deploy directory from host to container running:
docker run --name some-karaf -d \
-p 1099:1099 \
-p 8101:8101 \
-p 44444:44444 \
-v /host/path/deploy:/opt/karaf/deploy hlavki/karafYou can map local maven repository instead of hot deployment. This image adds /opt/maven/repository directory to org.ops4j.pax.url.mvn.defaultRepositories so you can also redeploy bundles with snapshot version without restart. To run docker with this setup run:
docker run --name some-karaf -d \
-p 1099:1099 \
-p 8101:8101 \
-p 44444:44444 \
-v ~/.m2/repository:/opt/maven/repository hlavki/karafKaraf docker image doesn't create volume from data directory. So it means it's stored in container. It's automatically removed If you remove container. But if you need to have data folder persistent, you can create volume or named volume.
docker run --name some-karaf -v /opt/karaf/data -d hlavki/karaf