In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
I believe many inexperienced people don't know what to do about how to use dockerfile in docker. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Copy the downloaded JDK to the server scp / jdk path / location where the jdk-8u211-linux-x64.tar.gz ubuntu@ server IP:/ writes the dockerfile / docker-centos-vim write dockerfile# Select the basic image I choose UbuntuFROM ubuntu:tag # tag as the version # add maintainer information LABEL version= "1.0" # version LABEL description= "this is an Image for Springboot application" # basic description LABEL maintainer= "haoyuehong91@163.com" # Maintainer Information # configure JDK# 1. Why do you use ADD instead of COPY inside the JDK ADD container on the host? because ADD decompresses and JDK is better to configure the environment variable ENV JAVA_HOME / soft/jdk1.8.0_211ENV JRE_HOME ${JAVA_HOME} / jreENV CLASSPATH.: ${JAVA_HOME} / lib:$ {JAR_HOME} / libENV PATH ${M2_HOME} / bin in the same directory as dockerfile. PATH# COPY the project jar package into the container with COPY because it will not unzip the COPY admin-0.0.1-SNAPSHOT.jar / app/# exposed port EXPOSE 900 switch to the working directory WORKDIR / app/# run the jar package # ENTRYPOINT ["java" "- jar", "/ app/admin-0.0.1-SNAPSHOT.jar"] or shell ENTRYPOINT nohub java-jar admin-0.0.1-SNAPSHOT.jar& to create an image docker build-t image_name.
Don't forget the rest.
Image_name is the name of the mirror
Build the container docker run-d-- name container-p 9000 image_nmae 8000 image_nmae
-d represents the daemon if you want to change-d to-it interactively
-- name is followed by a custom name
-p port mapping above means to map port 8000 in the container to port 9000 of the host
After reading the above, have you mastered how to use dockerfile in docker? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.