From the course: Kubernetes for Java Developers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Build a Docker image using a Dockerfile
From the course: Kubernetes for Java Developers
Build a Docker image using a Dockerfile
- [Instructor] We learned about the basics concepts of Docker Image, how an image can be built, what is a build context. Now, let's apply those concepts and actually build a Docker image for our Java application. As explained earlier, we're going to use Dockerfile to build our application. Here, this is a Dockerfile, part of our maven repo. This is the second file that we are explaining here now. As you can see, this is a multi stage Dockerfile. Here is my first from statement, and here is my second from statement. The first from statement is using maven as a base image. And I'm specifying a tag that means I want maven version three point five and jdk eight. You can look at Docker Hub and see where these images are available and what other tags are available if you need a different version of maven. I'm giving this stage a name, call it Build. The first step here is taking a repository.tar.gz which will generate in a second and copying it to a specific directory in the maven image…