Tag: java

Consul and Spring Boot services in Docker – not deregistering

So we have Java microservices written with Spring-Boot, using Consul for service discovery and config management and running in Docker containers. All of it is working, but when a container dies or a service restarts the old service-id never goes away in Consul and the service forever after shows as “Failing” in the Consul UI, […]

Docker – Get bound port inside java application

I am creating a instance of my image like docker run -P webmodule-xy The Dockerfile for the webmodule exposes a port (e.g. 8080). My goal now is to obtain the mapped / assigned port number which is accessible from the outside via Java. Is there a environment variable or something like that? Usecase: The webmodule-xy […]

How to install a specific version of Java 8 using Dockerfile

I am trying to build a Docker Container (using a Dockerfile) with a specific version of Java 8 on it. A lot of the examples target the latest release. RUN add-apt-repository -y ppa:webupd8team/java RUN apt-get update -y RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections RUN apt-get install -y oracle-java8-installer I have a need […]

How to reduce my java/gradle docker image size?

I have a Docker file like the following: FROM openjdk:8 ADD . /usr/share/app-name-tmp WORKDIR /usr/share/app-name-tmp RUN ./gradlew build \ mv ./build/libs/app-name*.jar /usr/share/app-name/app-name.jar WORKDIR /usr/share/app-name RUN rm -rf /usr/share/app-name-tmp EXPOSE 8080 RUN chmod +x ./docker-entry.sh ENTRYPOINT [ “./docker-entry.sh” ] The problem is that the final image size is 1.1GB, I know it happens because gradle downloads […]

Connect to HBase running in Docker

I cannot connect to HBase running in Docker on Windows (banno/hbase-standalone image). However, I can connect to locally installed HBase. banno/hbase-standalone image is run using: docker run -d -p 2181:2181 -p 60000:60000 -p 60010:60010 -p 60020:60020 -p 60030:60030 banno/hbase-standalone I also set up the port forwarding on the boot2docker-vm (which is required when running on […]

JVM Memory Allocation In Docker (LXC) Container

We’ve dockerized a JVM (Scala) application, Java 1.7, and are trying to decide how to allocate memory. We have a single application running in the docker container. If the docker container is allocated 4GB of RAM, should we allocate 4GB (or maybe a little less just to be safe) to the JVM? As I understand […]

How to debug an application running in Docker with IntelliJ?

I have a Jetty application running in docker. I would like to debug this application using my local IntelliJ. I am on v 14.1, so I have installed the Docker Integration plugin. Under Clouds, I am using the default values that showed up when I click on the ‘+’. IntelliJ docs say this should be […]

JVM cant map reserved memory when running in Docker container

I cant seem to run java at all in a Docker container on my server. Even when issuing java -version, I get the following error. root@86088d679103:/# java -version OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000035ce1000000, 2555904, 1) failed; error=’Operation not permitted’ (errno=1) # # There is insufficient memory for the Java Runtime Environment to continue. […]

Docker creates huge image sizes

I pulled base ubuntu:latest image (size 192.7 MB) and installed only Oracle java7 (JDK) to it (size of tar.gz ~53MB) and committed the resulting image. The image size is 903MB. Why has the image size increased by such huge margin? We still need to add other components (tom cat, vertx, mysql, etc.). The image size […]

docker jboss7 war commit. Server boot failed in an unrecoverable manner

Is there some way to deploy .war files into Jboss-as7 running inside a docker container Because my jboss server seems to fail after a docker commit. Could not rename /usr/local/share/jboss/standalone/configuration/standalone_xml_history/current to /usr/local/share/jboss/standalone/configuration/standalone_xml_history/20140107-050049692 I tried chmod +w usr/local/share/jboss/standalone/configuration/standalone_xml_history reference: https://docs.jboss.org/author/display/AS7/Configuration+file+history For now if I stop the docker container I have to deploy the war file and […]

Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.