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.

  • how to install an app inside of running docker container?
  • Golang: go build failing when called as part of makefile
  • Docker: updating image and registry
  • Is it possible to use a private git(hub) repo in Dockerfile ADD?
  • What causes flume with GCS sink to throw a OutOfMemoryException
  • side effect of --rm: when exit a container build with docker run --rm -v /myvol, also the volume is removed
  • 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

  • docker compose yaml - command
  • Change volume configuration in docker-compose without losing the data
  • Development env NodeJS and Docker
  • Docker-Composer exited with code 0
  • What's the meaning of docker hub's url design?
  • Volume on host - permission denied for Postgres (Mac OS)
  • 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.