Using a Self-Built Image for Deployment
This section uses TomEE-8.0.1-plus as an example.
- Create a tomee_dockerfile directory and go to the directory.
1mkdir tomee_dockerfile1cd tomee_dockerfile
- Download the TomEE installation package.
1wget https://archive.apache.org/dist/tomee/tomee-8.0.1/apache-tomee-8.0.1-plus.tar.gz --no-check-certificate
- Prepare the Dockerfile file in the tomee_dockerfile directory.
- Create and open the Dockerfile file.
1vim Dockerfile - Edit the Dockerfile file as follows:
FROM openjdk:11-jre ENV PATH /usr/local/tomee/bin:$PATH RUN mkdir -p /usr/local/tomee WORKDIR /usr/local/tomee COPY apache-tomee-8.0.1-plus.tar.gz /usr/local/tomee ENV TOMEE_VER 8.0.1 ENV TOMEE_BUILD plus RUN set -x \ && tar -zxf apache-tomee-8.0.1-plus.tar.gz \ && mv apache-tomee-${TOMEE_BUILD}-${TOMEE_VER}/* /usr/local/tomee \ && rm -Rf apache-tomee-${TOMEE_BUILD}-${TOMEE_VER} \ && rm bin/*.bat \ && rm apache-tomee-8.0.1-plus.tar.gz* # && useradd -g root tomee \ # && chown -R tomee:root /usr/local/tomee \ # && chmod -R g=u /usr/local/tomee #USER tomee EXPOSE 8080 CMD ["catalina.sh", "run"] - Press and enter :wq to save the file and exit.
- Create and open the Dockerfile file.
- Check the files in the tomee_dockerfile directory.
ls

- Build an installation image.
- Build an image.
Based on the Dockerfile file in the current directory, build an image named arm/test/tomee with the tag 11-jre-8.0.1-plus.
1docker build -t arm/test/tomee:11-jre-8.0.1-plus .
If the following information is displayed, the installation image is successfully built:
Successfully built xxxxxxxx Successfully tagged arm/test/tomee:11-jre-8.0.1-plus
Do not omit the dot (.) at the end of the docker build -t arm/test/tomee:11-jre-8.0.1-plus . command. Otherwise, an error may occur during the execution of the command.
- View the image.
1docker images
- Build an image.
- Run a container instance by using the image.
- Create a container and run it in the background.
Create a container named arm-test-tomee and map port 8080 in the container to port 9999 on the host machine. The container runs in daemon mode.
1docker run -itd -p 9999:8080 --name arm-test-tomee arm/test/tomee:11-jre-8.0.1-plus

- View the running container.
1docker ps
- Create a container and run it in the background.
- Verify the running of TomEE.
Open a browser and enter http://host IP:9999 in the address box to access port 9999 of the Docker host machine. If the home page of the TomEE service is displayed, the TomEE service is successfully deployed and running on the Docker.

- If port 9999 is occupied, you can use another port.
- In the official image, the installation directory of TomEE is /usr/local/tomee/, the configuration file is located in the /usr/local/tomee/conf/ directory, and the web application (WAR files) can be deployed in the /usr/local/tomee/webapps directory.
Parent topic: Docker