Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Share the method of making docker image

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

This article shares with you how to make docker images. There is a certain reference value, there are friends in need can refer to, I hope to help you.

Dockerfile is a text file containing all the commands to create an image. The docker build command allows you to build an image from the contents of Dockerfile.

1. Create a Dockerfile

#First create a folder called docker-adminmkdir docker-admin#Enter the folder docker-admin and create a Dockerfilecd docker-admin & vim Dockerfile

2. Edit Dockerfile

Edit the following content, the following COPY admin.war admin.war is our war file

FROM docker.io/tomcatMAINTAINER rstyroCOPY admin.war /usr/local/tomcat/webapps

3. Get to the.war file

can use your own

# github download address: wget https://github.com/rstyro/admin/raw/pack/pack/admin-0.0.1-SNAPSHOT.war# modify name mv admin-0.0.1-SNAPSHOT.war admin.war

4. build images

The # -t parameter is followed by the mirror name and tag. Dots indicate the current path docker build -t admin:1.0.0 .

5. Run the freshly built image

#Name it admin Local port mapping 8080docker run --name=admin -p 8080:8080 -d admin:1.0.0 The above is a brief introduction to sharing the method of making docker images. Of course, the differences above must be used by everyone to understand in detail. If you want to know more, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report