Use Docker with a JDK for Azure

Pre-built Docker images for Java 7, 8, and 11 are available through Docker Hub.

Certified Docker container images for Zulu JDK, JRE, and JRE-headless on multiple base OS images are available at Docker Hub:

Running a Docker image

Docker images can be run using the syntax $ docker run java as shown in the following example.

docker run java -version 

Creating a Docker image

You can create an image using Microsoft's official Docker Hub images as shown in the following examples.

Create a Docker file

RUN echo $' \
public class HelloWorld { \
   public static void main(String[] args) { \
      // Prints "Hello, World" in the terminal window. \
      System.out.println("Hello, World - From Microsoft Azure !!!"); \
   } \
}' >
RUN javac
CMD ["java", "HelloWorld"]

Build a Docker image

docker build -t hello-world

Run the new image

docker run hello-world

You will see the following output:

Hello World - From Microsoft Azure !!!