Docker Community Forums

Share and learn in the Docker community.

Base image for docker tomcat image

What is the base image for the Docker tomcat image?

It depends…

The OpenJDK version is based on openjdk image that is based on the debian image (up to JDK 11) and on the Oracle Linux image (from 12 and onwards) by default. But there is also an Alpine-version and a WindowsServerCore based version…

The Tomcat AWS version is based on AWS Corretto.

So the answer is “it depends”.

Interesting so it sounds like every version of Tomcat has an OS of some type as a part of the image. Have you ever heard of a tomcat image that only contained tomcat and was linked to other containers for the OS and JAVA?

It doesn’t make sense to “link to other containers”. That is not the way Docker works. The “linking” is done when you pull an image.

The Java in this case is different distributions, like the Corretto for AWS (that has nearly no OS at all as a base) is in a layer that is included and shared between all the images that uses the Corretto base.

If I have another application that uses the same Corretto JDK base image, it will share that layer when I pull and run them in a docker daemon.

Thanks I need to improve my knowledge of Docker then. It was my understanding that each image was a process.

So I am clear each tomcat image in Docker contains an OS, some java version and tomcat?

Yes, that is the nature of a Docker container. As a base, you have the Host OS. On the Host OS, you run the Docker Engine (DE). Each container running on the DE consists of libraries (layers) that behaves like different OS (but it is not a guest OS) and allows you to run command like it would be that OS. On top of that, you run your applications, like Tomcat.

As Tomcat is an application server, I can then, based on the different builds, deploy my own web-app (as a war) and run my tests for both the Corretto Java and OpenJDK versions of Java to make sure that they behave as they should. Same if I support different versions of Tomcat.

Have a look at https://www.edureka.co/blog/docker-explained/. That is a really good explanation.

I am new to Docker as I am sure that you can tell. But I want to be clear on what I can expect from a docker image.
I would like to give an example:
I need a tomcat7 docker container.
I have a basic docker environment setup.
The docker environment includes a centos 6 image, a tar file of the tomcat7 app and a tar file of the java software.
When I write my docker file would the From line be centos6:latest?
Or do I create a docker image from scratch from the tomcat and java tar files?

Sorry or not replying. Vacation.

If you have your custom application that you have written, and that demands Centos6 to be used, or even if you want to compile your application on Centos6, that would be the image to start from.

Would you however want to run a Tomcat, I would not build that image, since there are officially supported images that can be run instead. All you need to do is mount your app directory, or if needed, add it to a new image.