In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains the "use of dockerfile RUN,CMD,ENTRYPOINT", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "the use of dockerfile RUN,CMD,ENTRYPOINT" bar!
RUN
The RUN command executes the command and creates a new mirror layer, which is usually used to install the software package when building the image. Each RUN command creates a mirror layer. If you execute multiple commands, you can use & & to connect, which creates only one mirror layer.
RUN / bin/sh-c'cd / usr/share/nginx/html/ & & npm install'CMD
When you start the container, the command executed by default has three prerequisites
There is no ENTRYPOINT command
When you start the container with the docker run command, there are no arguments behind it, otherwise the CMD command will be overwritten, for example
Docker run-d centos / bin/sh-c "while true;do echo 6666 investors sleep 1 done"
Multiple CMD commands only execute the last one
If there is an ENTRYPOINT command in Dockerfile, the contents of CMD are placed at the end of the ENTRYPOINT command as command arguments. For example:
FROM java:8COPY * .jar / app.jarCMD ["--server.port=8080"] EXPOSE 8080ENTRYPOINT ["java", "- jar", "app.jar"]
The last order executed is
Java-jar app.jar-- server.port=8080ENTRYPOINT
For the command to be executed when starting the container, only the last command takes effect for multiple ENTRYPOINT.
ENTRYPOINT can also be replaced by a parameter in docker run at run time, but it is slightly more cumbersome than CMD and needs to be specified by the parameter entrypoint of docker run.
Thank you for your reading, the above is the content of "the use of dockerfile RUN,CMD,ENTRYPOINT", after the study of this article, I believe you have a deeper understanding of the use of dockerfile RUN,CMD,ENTRYPOINT, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.