Skip to content

Tomcat Docker image

The Tomcat Docker image provides a containerized runtime environment for Apache Tomcat, a popular Java servlet container and web server^[600-developer__docker__docker-tomcat.md].

Image Usage

The official image can be retrieved from Docker Hub using the pull command^[600-developer__docker__docker-tomcat.md].

Users can run the container interactively using docker run. For instance, to run a specific version like 8.0, the command is^[600-developer__docker__docker-tomcat.md]:

docker run -it --rm tomcat:8.0

To access the Tomcat service from the host machine, port mapping can be applied. The following command maps port 8888 on the host to port 8080 inside the container^[600-developer__docker__docker-tomcat.md]:

docker run -it --rm -p 8888:8080 tomcat:8.0

Persistence and Export

Working with Docker images and containers involves specific commands for saving and exporting states^[600-developer__docker__docker-tomcat.md].

Saving Images

The docker save command is used to persist an image to a tar file. This allows for the archiving of specific images (e.g., busybox-1) rather than containers^[600-developer__docker__docker-tomcat.md].

Exporting Containers

In contrast, the docker export command is used to persist the state of a specific container. This requires the container ID (<CONTAINER ID>) to export the file system into a tar archive^[600-developer__docker__docker-tomcat.md].

  • [[Docker]]
  • Java
  • [[Web Server]]

Sources

^[600-developer__docker__docker-tomcat.md]