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

Analyze how uniapp dynamically obtains the interface domain name

background The interface domain name is not hard-...

Web skills: Multiple IE versions coexistence solution IETester

My recommendation Solution for coexistence of mul...

How to import and export Docker images

This article introduces the import and export of ...

Example of how to configure the MySQL database timeout setting

Table of contents Preface 1. JDBC timeout setting...

Complete steps to install FFmpeg in CentOS server

Preface The server system environment is: CentOS ...

Three ways to delete a table in MySQL (summary)

drop table Drop directly deletes table informatio...

Vue+echarts realizes progress bar histogram

This article shares the specific code of vue+echa...

CSS3 mouse hover transition zoom effect

The following is a picture mouse hover zoom effec...

Using NTP for Time Synchronization in Ubuntu

NTP is a TCP/IP protocol for synchronizing time o...

How to determine if the Linux system is installed on VMware

How to determine whether the current Linux system...

How to gracefully and safely shut down the MySQL process

Preface This article analyzes the process of shut...

A commonplace technique for implementing triangles using CSS (multiple methods)

In some interview experiences, you can often see ...