Sophia Parafina

Author Archives: Sophia Parafina

Top 5 Post: Improved Docker Container Integration with Java 10

As 2018 comes to a close, we looked back at the top five blogs that were most popular with our readers. For those of you that had difficulties with memory and CPU sizing/usage when running Java Virtual Machine (JVM) in a container, we are kicking off the week with a blog that explains how to get improved Docker container integration with Java 10 in Docker Desktop ( Mac or Windows) and Docker Enterprise environments.

Docker and Java

Many applications that run in a Java Virtual Machine (JVM), including data services such as Apache Spark and Kafka and traditional enterprise applications, are run in containers. Until recently, running the JVM in a container presented problems with memory and cpu sizing and usage that led to performance loss. This was because Java didn’t recognize that it was running in a container. With the release of Java 10, the JVM now recognizes constraints set by container control groups (cgroups). Both memory and cpu constraints can be used manage Java applications directly in containers, these include:

  • adhering to memory limits set in the container
  • setting available cpus in the container
  • setting cpu constraints in the container

Java 10 improvements are realized in both Docker Desktop ( Mac Continue reading

Video Series: Modernizing Java Apps for Developers Part 5

Moving a monolithic application to a modern cloud architecture can be difficult and often result in a greenfield development effort. However, it is possible to move towards a cloud architecture using Docker Enterprise Edition (EE) with no code changes and gain portability, security and efficiency in the process.

To conclude the series In part 5, I use the message service’s REST endpoint to replace one part of the application UI with a Javascript client. The original application client UI was written in Java Server Pages (JSP) so that any UI changes required the application to be recompiled and redeployed. I can use modern web tools and frameworks such as React.js to write a new client interface. I’ll build the new client using a multi-stage build and deploy it by adding the container to the Docker Compose file. I’ll also show how to deploy the entire application from your development to Docker EE to make it available for testing.

Modernizing Java Apps for Developers shows how to take an existing Java N-tier application and run it in containers using the Docker platform to modernize the architecture. The source code for each part of this series is available on github and Continue reading

Video Series: Modernizing Java Apps for Developers Part 4

Java Apps

Moving a monolithic application to a modern cloud architecture can be difficult and often result in a greenfield development effort. However, it is possible to move towards a cloud architecture using Docker Enterprise Edition (EE)  with no code changes and gain portability, security and efficiency in the process.

Java Apps

Part 4 takes advantage of the messaging service I added in part 3. In this installment, I’ll add self service analytics powered by the open source Elasticsearch / Kibana stack. The reporting database and analytics UI run in containers and the worker is updated to also store data in Elasticsearch. The Docker platform supports adding new components to a running deployment without shutting down the application containers that are currently running. You’ll learn how Docker lets you add new capabilities to the application with zero downtime in production.


Docker MTA Video Series: Modernizing Java Apps for Developers
Click To Tweet


To learn more about Docker for Java Developers:

The post Video Series: Modernizing Java Apps for Developers Part 4 appeared first on Docker Blog.

Improved Docker Container Integration with Java 10

Docker and Java

Many applications that run in a Java Virtual Machine (JVM), including data services such as Apache Spark and Kafka and traditional enterprise applications, are run in containers. Until recently, running the JVM in a container presented problems with memory and cpu sizing and usage that led to performance loss. This was because Java didn’t recognize that it was running in a container. With the release of Java 10, the JVM now recognizes constraints set by container control groups (cgroups). Both memory and cpu constraints can be used manage Java applications directly in containers, these include:

  • adhering to memory limits set in the container
  • setting available cpus in the container
  • setting cpu constraints in the container

Java 10 improvements are realized in both Docker for Mac or Windows and Docker Enterprise Edition environments.

Container Memory Limits

Until Java 9 the JVM did not recognize memory or cpu limits set by the container using flags. In Java 10, memory limits are automatically recognized and enforced.

Java defines a server class machine as having 2 CPUs and 2GB of memory and the default heap size is ¼ of the physical memory. For example, a Docker Enterprise Edition installation has 2GB of memory and Continue reading

Video Series: Modernizing Java Apps for Developers Part 3

Docker for Java

Moving a monolithic application to a modern cloud architecture can be difficult and often result in a greenfield development effort. However, it is possible to move towards a cloud architecture using Docker Enterprise Edition with no code changes and gain choice , security and operational agility in the process.

Docker for Java

Part 3 of the series begins the modernization process. I’ll take one aspect of the current application and break it out into a microservice. As written, the application writes to the database directly, but direct writes to the database can easily overwhelm the application by a large number of requests.

One solution is to implement a messaging queue. As in the part 2, I’ll follow several guidelines:

  1. Leave existing code in place.
  2. Design the new code as a separate and reusable application
  3. Deploy the microservice locally using Docker Enterise Edition
  4. Test the code

In this part of the modernization process, I add a message queue comprised of a REST interface that writes to a Redis database. The user data is held in Redis until it’s requested by a worker service that does the write to the database. The message queue uses Spring Boot to implement both the REST interface and the Redis database functions. Continue reading

Video Series: Modernizing Java Apps for Developers Part 2

Java apps

Moving a monolithic application to a modern cloud architecture can be difficult and often results in a greenfield development effort. However, it is possible to move towards a cloud architecture using Docker Enterprise Edition with no code changes and gain portability, security and efficiency in the process.

 Java apps

In the first post in this series, we discussed how you don’t need to do a full re-architecture of your application to microservices when using Docker Enterprise Edition.

In the second installment of the series, I go into the details of containerization of the application. This process builds containers using the application code as-is. I’ll follow three simple rules:

  1. Keep the existing architecture
  2. Keep the save version of the OS, components and application
  3. Keep deployment simple, i.e. static not elastic

I’ll also demonstrate how to use multi-stage build file to compile the code and deploy it to application server container such as Tomcat. It also shows how to deploy the application and database using a Docker Compose file.


Video Series: Modernizing @Java Apps for #Developers with #docker EE
Click To Tweet


To learn more about Docker solutions for Developers:

Video Series: Modernizing Java Apps for Developers Part 1

Modernizing Java Apps

Moving a monolithic application to a modern cloud architecture can be difficult and often result in a greenfield development effort. However, it is possible to move towards a cloud architecture using Docker Enterprise Edition with no code changes and gain portability, security and efficiency in the process.

Containerizing a monolithic application is a great starting point for modernizing application architecture.In many cases this can be done with no code changes at all.  From there, breaking down the application into smaller components makes it easier to deploy updates, introduce new components and manage scale.

This new video series covers modernization for Java applications. It walks through the process of evolving a N-tier Java application to a distributed application running across multiple containers. Docker provides the platform that plugs in and manages all the components into a coherent architecture.

This  series does not cover a full re-architecture to microservices. Shifting to a full microservices approach isn’t right for all applications, and the daunting task of a full rewrite of a monolithic application can be a massive endeavor that takes years to pay-off. Especially if what you have works. This series uses a feature driven approach. I select key features to update, in order to fix Continue reading

Top 5 blogs of 2017: Spring Boot Development with Docker

We’ve rounded up the top five most popular Docker blogs of 2017. Coming in at number four is, Spring Boot Development With Docker, part of a multi-part tutorial series.


The AtSea Shop is an example storefront application that can be deployed on different operating systems and can be customized to both your enterprise development and operational environments. In my last post, I discussed the architecture of the app. In this post, I will cover how to setup your development environment to debug the Java REST backend that runs in a container.

Building the REST Application

I used the Spring Boot framework to rapidly develop the REST backend that manages products, customers and orders tables used in the AtSea Shop. The application takes advantage of Spring Boot’s built-in application server, support for REST interfaces and ability to define multiple data sources. Because it was written in Java, it is agnostic to the base operating system and runs in either Windows or Linux containers. This allows developers to build against a heterogenous architecture.

Project setup

The AtSea project uses multi-stage builds, a new Docker feature, which allows me to use multiple images to build a single Docker image that includes all the components needed for Continue reading

Modernizing Java Apps with Docker

Modernizing Traditional Applications or MTA was one of the themes at DockerCon EU 2017. Traditional applications are typically built a number of  years ago but are critical to business operations. The developer and operational skill set to maintain the application may be hard to find. The code base can be difficult to maintain, if it is available at all. The team that wrote the original app may not even be around. The applications go into maintenance mode, which may mean they are patched regularly for vulnerabilities. Any revisions to the code can take significant number of hours to test and deploy, so updates are infrequent. It can also hold back infrastructure improvements as dependency management becomes a huge pain point.

Java Apps Docker

Any modern application needs a faster delivery time that can adapt to change in the market conditions. The pipeline from pushing the code to a source code repository to the application delivery should be efficient, automated, secure and fast. The application should be able to scale to demand, typically done by horizontal scaling across multiple instances. Portability of the application across different infrastructure becomes key in that case. In case of a failure, MTTR should be short and Continue reading

Videos series: Modernizing Java Apps for IT Pros

Today we start releasing a new video series in Docker’s Modernize Traditional Apps (MTA) program, aimed at IT Pros who manage, maintain and deploy Java apps. The video series shows you how to move a Java EE 7 application written to run on Wildfly 3, move it to a Windows Docker container and deploy it to a scalable, highly-available environment in the cloud – without any changes to the app.

These are the first 4 of a 5 part video series in Docker’s Modernize Traditional Apps (MTA) program, aimed at Java IT Pros. The video series shows you how to move a Java EE app on JBoss Wildfly to a Docker container and deploy it to a scalable, highly-available environment in the cloud – without any changes to the app.

Modernizing Java Apps

Part 1 introduces the series, explaining what is meant by “traditional” apps and the problems they present. Traditional apps are built to run on a server, rather than on a modern application platform. They have common traits, like being complex to manage and difficult to deploy. A portfolio of traditional applications tends to under-utilize its infrastructure, and over-utilize the humans who manage it. Docker Enterprise Edition (EE) fixes that, giving Continue reading

Securing the AtSea App with Docker Secrets

Passing application configuration information as environmental variables was once considered best practice in 12 factor applications. However, this practice can expose information in logs, can be difficult to track how and when information is exposed, third party applications can access this information. Instead of environmental variables, Docker implements secrets to manage configuration and confidential information.

Secrets are a way to keep information such as passwords and credentials secure in a Docker CE or EE with swarm mode. Docker manages secrets and securely transmits it to only those nodes in the swarm that need access to it. Secrets are encrypted during transit and at rest in a Docker swarm. A secret is only accessible to those services which have been granted explicit access to it, and only while those service tasks are running.

The AtSea Shop is an example storefront application that can be deployed on different operating systems and can be customized to both your enterprise development and operational environments. The previous post showed how to use multi-stage builds to create small and efficient images. In this post, I’ll demonstrate how secrets are implemented in the application.

Creating Secrets

Secrets can be created using the command line or with a Compose file. The AtSea Continue reading

Multi-Stage Builds

This is part of a series of articles describing how the AtSea Shop application was built using enterprise development tools and Docker. In the previous post, I introduced the AtSea application and how I developed a REST application with the Eclipse IDE and Docker. Multi-stage builds, a Docker feature introduced in Docker 17.06 CE, let you orchestrate a complex build in a single Dockerfile. Before multi-stage build, Docker users would use a script to compile the applications on the host machine, then use Dockerfiles to build the images. The AtSea application is the perfect use case for a multi-stage build because:

  • it uses node.js to compile the ReactJs app into storefront
  • it uses Spring Boot and Maven to make a standalone jar file
  • it is deployed to a standalone JDK container
  • the storefront is then included in the jar

Let’s look at the Dockerfile.

The react-app is an extension of create-react-app. From within the react-app directory we run AtSea’s frontend in local development mode.

The first stage of the build uses a Node base image to create a production-ready frontend build directory consisting of static javascript and css files. A Docker best practice is named stages, e.g. FROM Continue reading

Spring Boot Development with Docker

The AtSea Shop is an example storefront application that can be deployed on different operating systems and can be customized to both your enterprise development and operational environments. In my last post, I discussed the architecture of the app. In this post, I will cover how to setup your development environment to debug the Java REST backend that runs in a container.

Building the REST Application

I used the Spring Boot framework to rapidly develop the REST backend that manages products, customers and orders tables used in the AtSea Shop. The application takes advantage of Spring Boot’s built-in application server, support for REST interfaces and ability to define multiple data sources. Because it was written in Java, it is agnostic to the base operating system and runs in either Windows or Linux containers. This allows developers to build against a heterogenous architecture.

Project setup

The AtSea project uses multi-stage builds, a new Docker feature, which allows me to use multiple images to build a single Docker image that includes all the components needed for the application. The multi-stage build uses a Maven container to build the the application jar file. The jar file is then copied to a Java Development Kit image. This Continue reading

Developing a Spring Boot app on Docker: The AtSea Demo App

This is the first of a series of blog posts that demonstrates using Docker to develop a typical web application and deploying it in production. For DockerCon 2017, we wanted to build a new demo application that would demonstrate the flexibility of using Docker in development as well as showcase the features of Docker in a production environment. The result was the AtSea Shop, a storefront application that can be deployed on different operating systems and can be customized to both your enterprise development and operational environment.

A Hybrid Architecture

The team decided on a few ground rules. First, we wanted to use modern components commonly used in enterprise applications. We decided to build a Java application using the Spring Boot framework. The web client is a javascript application written using React as a framework.  Second, the application should be able to use any relational database and that it could be deployed on a Linux or Windows environment or cluster. Finally, the team wanted to show the process from development to deployment including building the application, implementing security, and deploying the application.

Docker Demo App

The application combines a typical Java n-tier architecture that uses Spring Boot’s web MVC framework for the REST API Continue reading

Live Debugging Java in Docker – Just in time for JavaOne!

Developing Java web applications often requires that they can be deployed on multiple technology stacks. These typically include an application server and a database, but these components can vary from deployment to deployment. Building and managing multiple development stacks in a development environment can be a time consuming task often requiring unique configurations for each stack.

Docker can simplify the process of building and maintaining develop environments for Java web applications by building custom images that application developers can create on demand and use for development, testing and debugging applications. We have recently published a tutorial for building a Java web application using containers and three popular Java IDEs.  Docker enables developers to debug their code as it runs in containers. The tutorial covers setting up a debug session with an application server in Docker using IDEs that developers typically use such as Eclipse, IntelliJ IDEA and Netbeans. Developers can build the application, change code, and set breakpoints while the application is running in the container. The tutorials use a simple Spring MVC application to illustrate how use containers when developing Java applications

The tutorial is available on GitHub in our Docker Labs repository. These tutorials show you how to: