Docker Java 8 Container with Heavy CPU Usage

We are currently dockerize a Java 8 Application and we have a really strange behaviour. Outside of docker, the application use less than 10% of cpu but when we run the application into a container we have 100% of CPU usage for the container.

Inside of the container (with docker exec -it [container-id] top), the jar only use 10% of cpu.

  • sudo: docker-compose: command not found
  • Pyfora Initialization error
  • Access hosts zfs from docker container
  • Why declare like “var _ I = T{}” and “var _ I = &T{}” continuously in golang?
  • Can't build docker image via gradle on Windows 10
  • Configuring the network interface's index of a Docker container
  • We attempt to use other base docker image like openjdk but it change nothing.

    Docker File:

    FROM anapsix/alpine-java:8
    ADD . /producer
    WORKDIR /producer
    COPY ikb-1.0-SNAPSHOT-producer.jar ikb-1.0-SNAPSHOT-producer.jar
    COPY resources/ /resources/
    CMD ["java", "-jar", "ikb-1.0-SNAPSHOT-producer.jar"]

    We use:

    • Docker version: 1.13.1, build 092cba3
    • Docker-compose version: 1.11.2, build dfed245
    • Server OS: CentOS

  • How do I register logging driver for docker?
  • Docker and netstat: netstat is not showing ports, exposed by docker containers
  • checkpoint is not a docker command
  • Disable cache for specific RUN commands
  • Windows Docker mongo container doesn't work with volume mount
  • Docker for Mac tutorial- overlapping export paths
  • One Solution collect form web for “Docker Java 8 Container with Heavy CPU Usage”

    As discussed in our chat, there was a thread in the Java application that was spinning in a tight loop because there was no user input. Stopping that thread caused the CPU to go back to where it belonged.

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