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

Implementation example of scan code payment in vue project (with demo)

Table of contents Demand background Thought Analy...

VUE Getting Started Learning Event Handling

Table of contents 1. Function Binding 2. With par...

How to change the MySQL database directory location under Linux (CentOS) system

How to change the MySQL database directory locati...

Disabled values ​​that cannot be entered cannot be passed to the action layer

If I want to make the form non-input-capable, I se...

Introduction to document.activeELement focus element in JavaScript

Table of contents 1. The default focus is on the ...

How to deal with too many Docker logs causing the disk to fill up

I have a server with multiple docker containers d...

Introduction to new features of MySQL 8.0.11

MySQL 8.0 for Windows v8.0.11 official free versi...

MySQL 8.0.18 uses clone plugin to rebuild MGR implementation

Assume that a node in the three-node MGR is abnor...

Three examples of nodejs methods to obtain form data

Preface Nodejs is a server-side language. During ...

Javascript operation mechanism Event Loop

Table of contents 1. Four concepts 1. JavaScript ...

Tutorial diagram of installing CentOS and Qt in Vmware virtual machine

Vmware Installation Installing Packages Download ...

Tutorial on setting up scheduled tasks to backup the Oracle database under Linux

1. Check the character set of the database The ch...

Detailed explanation of the process of building and running Docker containers

Simply pull the image, create a container and run...