How to run a project with docker

How to run a project with docker

1. Enter the directory where your project war is stored

Edit the Dockerfile

vim Dockerfile

The content is as follows:

rom registry.docker-cn.com/library/tomcat

MAINTAINER heihezi [email protected]

COPY myproject.war /usr/local/tomcat/webapps

2. Build your own image

docker build -t myproject:latest .

As expected, the steps of building the image will be displayed, and the last line is

Successfully built b3f6ac3157ae

The last string is part of the image id.

At this point you can run docker images to view your image information

3. Run your own docker container

docker run -d -p 8888:8080 myproject

Here -d means running in the background, -p means specifying the port, and the following 8888:8080 means mapping the host's port 8888 to the docker's port 8080. If the operation is successful, an id will be printed out.

4. Access your own projects

Check whether Tomcat is started successfully

192.168.1.178:8888

Visit project (add project name)

192.168.1.178:8888/myproject

This is the end of this article about how to run projects with docker. For more information about how to run projects with docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

<<:  Implementation of MySQL asc and desc data sorting

>>:  Detailed explanation of JavaScript to monitor route changes

Recommend

Detailed explanation of the use of HTML header tags

HTML consists of two parts: head and body ** The ...

What are Web Slices?

IE8 new feature Web Slices (Web Slices) Microsoft...

WeChat applet learning notes: page configuration and routing

I have been studying and reviewing the developmen...

Detailed explanation of Js class construction and inheritance cases

The definition and inheritance of classes in JS a...

How to place large images in a small space on a web page

Original source: www.bamagazine.com There are nar...

Four data type judgment methods in JS

Table of contents 1. typeof 2. instanceof 3. Cons...

How to use async and await correctly in JS loops

Table of contents Overview (Loop Mode - Common) D...

WeChat applet implements calculator function

This article shares the specific code for the WeC...

Example of using mycat to implement MySQL database read-write separation

What is MyCAT A completely open source large data...

Docker commands are implemented so that ordinary users can execute them

After installing docker, there will usually be a ...

VMware vsphere 6.5 installation tutorial (picture and text)

vmware vsphere 6.5 is the classic version of vsph...

Summary of JS tips for creating or filling arrays of arbitrary length

Table of contents Preface Direct filling method f...

Several situations where div is covered by iframe and their solutions

Similar structures: Copy code The code is as foll...