Java on Docker

Running Java apps on Docker

@augustojimenez1

Augusto Alonso de Cruz Jimenez

13 de diciembre de 2018

@augustojimenez1

Augusto Alonso de Cruz Jimenez

"First, solve the problem. Then, write the code."

 

John Johnson

Agenda

  • What is Docker?
  • What is a container?
  • Containers vs VMs
  • Docker advantages
  • Challeges using containers
  • Let's try it
  • Docker image
  • Dockerfile
  • Running the Java App

@augustojimenez1

Augusto Alonso de Cruz Jimenez

What is Docker?

Docker is a tool designed to make it easier to:

  • create
  • deploy
  • run

applications by using containers.

 

Docker is open source

@augustojimenez1

Augusto Alonso de Cruz Jimenez

What is a container?

  • The app, and all the libraries it needs to run, are packaged as one package.
  • Not a whole virtual operating system.
  • Only ships things that are not already running on the host computer.
  • Containers are isolated.
  • More efficient in system resource terms.

@augustojimenez1

Augusto Alonso de Cruz Jimenez

Containers vs VMs

Credits: blog.docker.com

@augustojimenez1

Augusto Alonso de Cruz Jimenez

Docker advantages

  • It's can be considered a DevOps tool.
  • Faster development.
  • Thousands of pre-existing images.
  • Reduced application size.
  • More apps running on the same hardware.
  • Well supported.
  • Extensive documentation.
  • Well used, Docker allows horizontal scalability.

@augustojimenez1

Augusto Alonso de Cruz Jimenez

Challenges using containers

  • Since containers are intended to be used for lightweight applications, they are mostly used for microservices
  • Security
  • Logging
  • Monitoring
  • Ephimeral state
  • Short lifetime

 

The answer is cloud orchestration tools: Docker Swarm, k8s, Mesosphere.

@augustojimenez1

Augusto Alonso de Cruz Jimenez

Let's try it...

@augustojimenez1

Augusto Alonso de Cruz Jimenez

Images and Dockerfile

  • A Docker image is a file, comprised of multiple layers.
  • An image is built from the instructions for a complete and executable version of an application
  • When the Docker user runs an image, it becomes one or multiple instances of that container.
  • Reusing layers saves time.

@augustojimenez1

Augusto Alonso de Cruz Jimenez

Images and Dockerfile...

  • Docker builds images by reading instructions from a Dockerfile
  • It is a simple text file that contains instructions that can be executed on the command line

 

 

Example of an Dockerfile...

@augustojimenez1

Augusto Alonso de Cruz Jimenez

Q&A

@augustojimenez1

Augusto Alonso de Cruz Jimenez

Thank you!!!

@augustojimenez1

Augusto Alonso de Cruz Jimenez

Running Java Apps on Docker

By Augusto Alonso de la Cruz Jimenez

Running Java Apps on Docker

  • 11