![Docker and Kubernetes for Java Developers](https://img.perlego.com/books/RM_Books/packt_pub_vpnckweg/9781786463906_300_450.webp)
Docker and Kubernetes for Java Developers
Jaroslaw Krochmalski
- 318 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Docker and Kubernetes for Java Developers
Jaroslaw Krochmalski
About This Book
Leverage the lethal combination of Docker and Kubernetes to automate deployment and management of Java applicationsAbout This Book⢠Master using Docker and Kubernetes to build, deploy and manage Java applications in a jiff⢠Learn how to create your own Docker image and customize your own cluster using Kubernetes⢠Empower the journey from development to production using this practical guide.Who This Book Is ForThe book is aimed at Java developers who are eager to build, deploy, and manage applications very quickly using container technology. They need have no knowledge of Docker and Kubernetes.What You Will Learn⢠Package Java applications into Docker images⢠Understand the running of containers locally⢠Explore development and deployment options with Docker⢠Integrate Docker into Maven builds⢠Manage and monitor Java applications running on Kubernetes clusters⢠Create Continuous Delivery pipelines for Java applications deployed to KubernetesIn DetailImagine creating and testing Java EE applications on Apache Tomcat Server or Wildfly Application server in minutes along with deploying and managing Java applications swiftly. Sounds too good to be true? But you have a reason to cheer as such scenarios are only possible by leveraging Docker and Kubernetes.This book will start by introducing Docker and delve deep into its networking and persistent storage concepts. You will then proceed to learn how to refactor monolith application into separate services by building an application and then packaging it into Docker containers. Next, you will create an image containing Java Enterprise Application and later run it using Docker. Moving on, the book will focus on Kubernetes and its features and you will learn to deploy a Java application to Kubernetes using Maven and monitor a Java application in production. By the end of the book, you will get hands-on with some more advanced topics to further extend your knowledge about Docker and Kubernetes.Style and approachAn easy-to-follow, practical guide that will help Java developers develop, deploy, and manage Java applications efficiently.
Frequently asked questions
Information
Creating Images with Java Applications
- Creating a Dockerfile
- Dockerfile instructions
- Building the image
- Creating and removing images
Dockerfile
- First, you prepare a text file named Dockerfile, which contains a series of instructions on how to build the image. The set of instructions you can use in the Dockerfile is not very broad, but sufficient to fully instruct Docker how to create an image.
- Next, you execute the docker build command to create a Docker image based on the Dockerfile that you have just created. The docker build command runs within the context. The build's context is the files at a specified location, which can be a PATH or a URL. The PATH is a directory on your local filesystem and the URL is a Git repository location. A context is processed recursively. PATH will include any subdirectories. The URL will include the repository and its submodules.
Dockerfile instructions
FROM
- openjdk: An official repository containing an open-source implementation of the Java platform, Standard Edition. The tag latest, which will be used if you do not specify any tag, points to the 8u121-alpine OpenJDK release, as of the time of writing this book
- fabric8/java-alpine-openjdk8-jdk: This base image is actually also being used by the fabric8 Maven plugin
- frolvlad/alpine-oraclejdk8: There are three tags you can choose from: full (only src tarballs get removed), cleaned (desktop parts get cleaned), slim, everything but the compiler and JVM is removed. The tag latest points to the cleaned one
- jeanblanchard/java: A repository containing images based on Alpine Linux to keep the size minimal (about 25% of an Ubuntu-based image). The tag latest points to Oracle Java 8 (Server JRE)
FROM jeanblanchard/java:8
MAINTAINER
MAINTAINER authors_name
WORKDIR
ADD
ADD <source path or URL> <destination path >