Steps to deploy multiple tomcat services using DockerFile on Docker container

Steps to deploy multiple tomcat services using DockerFile on Docker container

1.

[admin@JD ~]$ cd opt

#Enter opt in the root directory

2.

[admin@JD opt]$ mkdir web

#Create a Web folder

3.

[admin@JD web]$ cd web/

#Enter the web folder

4.

[admin@JD web]$ touch Dockerfile

#Create a Dockerfile folder. The name must be correct. Otherwise, it cannot be detected.

5.

Use third-party tools to upload tomcat and jdk to the Web folder

6.

[admin@JD web]$ vim Dockerfile

#Edit the file and write the following content

FROM centos
MAINTAINER
ADD ./apache-tomcat-7.0.88.tar.gz /root
ADD ./jdk-7u80-linux-x64.tar.gz /root
ENV JAVA_HOME /root/jdk1.7.0_80
ENV PATH $JAVA_HOME/bin:$PATH
ENTRYPOINT /root/apache-tomcat-7.0.88/bin/startup.sh && tail -F /root/apache-tomcat-7.0.88/logs/catalina.out

Resource Downloads

FROM command, usage, FROM <image>:<tag>, the FROM command tells Docker which (distribution) image we are building is based on

ENV command, usage, ENV <key> <value>, the ENV command is mainly used to set the environment variables when the container is running

ADD command, usage, ADD <src> <dest>, ADD is mainly used to add files in the host machine to the image

7.

[admin@JD web]$ docker build -t test/centos:tomcat-centos --rm=true .

#-t specifies the resource name to be customized

# --rm=rtue Reduce the generation of non-specified files

# After some files are automatically generated and downloaded, the request may time out.

8.

[admin@JD web]$ docker run -d -p 9090:8080 fe8d

#Start tomcat and map port 8080 to port 9090 fe8d The first four digits of the resource ID

9.

[admin@JD web]$ docker run -d -p 9091:8080 fe8d

# Start the second tomcat port without conflict!!

10. Open the browser server ip + port number and you can see the cat #docker will automatically add firewall rules. I use iptables firewall

Simply build the dockerfile file and complete it!

Additional knowledge: Building open source object storage (minio) in docker

We did a project some time ago. The customer could not get the data to the external network, so we could only build OSS object storage on the internal network. We relied on Jidao's platform to do business. They adopted the S3 standard, so we used minio to build an open source OSS object storage space. It was actually very simple.

docker pull minio/minio pulls the image from the repository

docker run -p 9000:9000 --name minio1
-e “MINIO_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE”
-e "MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
-v /mnt/data:/data
-v /mnt/config:/root/.minio
minio/minio server /data

start up

Let's talk about why to choose minio

(1) C++ interface support is required. Since the S3 standard is adopted, Amazon AWS can use it.

(2) This is a lightweight, highly concurrent solution

(3) Compared with FastDFS or HDFS, the advantage is that it can reserve a certain feasibility for the front-end display.

I will post the C++ and Java packages later.

The above steps of deploying multiple tomcat services using DockerFile on Docker containers are all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Docker uses Dockerfile to create a container image that supports automatic startup of ssh service
  • Dockerfile implementation code when starting two processes in a docker container
  • Running a Java Web project built with MyEclipse in a Dockerfile container in Docker
  • How to create a simple container using Dockerfile

<<:  8 powerful techniques for HTML web page creation

>>:  Detailed explanation of the rounding accuracy problem of the toFixed() method in JS

Recommend

Using an image as a label, the for attribute does not work in IE

For example: Copy code The code is as follows: <...

Vue uses Echarts to implement a three-dimensional bar chart

This article shares the specific code of Vue usin...

A detailed introduction to the use of block comments in HTML

Common comments in HTML: <!--XXXXXXXX-->, wh...

Detailed explanation of samba + OPENldap to build a file sharing server

Here I use samba (file sharing service) v4.9.1 + ...

Mysql Sql statement comments

You can add comments to MySQL SQL statements. Her...

JavaScript to achieve tab switching effect

This article shares the specific code of JavaScri...

Detailed explanation of JavaScript program loop structure

Table of contents Select Structure Loop Structure...

MySQL 5.7.18 free installation version window configuration method

This is my first blog. It’s about when I started ...

CSS3 realizes various graphic effects of small arrows

It’s great to use CSS to realize various graphics...

Detailed explanation of the this pointing problem in JavaScript

Summarize Global environment ➡️ window Normal fun...

Summary of JavaScript Timer Types

Table of contents 1.setInterval() 2.setTimeout() ...

A brief discussion on the correct approach to MySQL table space recovery

Table of contents Preliminary Notes Problem Repro...

Use of Vue3 table component

Table of contents 1. Ant Design Vue 1. Official w...