In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
A brief introduction to DockerFile
1. Introduction
What is docker file?
Docker file is just some text instructions.
Save these instructions as a text file
Then create the docker image by invoking these text files from the command line
Composition and structure of docker file
# indicates comment information
Instruction parameter
One instruction per line, which is usually written in uppercase, but is actually case-insensitive.
The first non-comment line in docker file must be FROM (this is used to specify the base image, because we know that making images is based on a base image. )
The content in docker file is executed from top to bottom.
Docker file usage requirements
The first requirement: first, there should be a working directory with a docker file file in the directory and the first letter should be capitalized as follows
The second requirement: all the relevant files that need to be used must be placed in this directory or subdirectory, for example, if we want to install RPM packages and configuration files in the container, we must put them here.
When making an image, if you put a subdirectory into the image, then all the files under the subdirectory will be mirrored.
There is a special case, for example, there are some files in the subdirectory that we do not want to put into the image, so we can exclude these files at this time.
Under the working directory, there should also be a hidden file: dockeringore
This file can realize that the specified file should not be put into the image.
The way to do this is to write the path of the file to be ignored one by one into the hidden file
When the working directory is ready for a while, you can make a mirror image.
You can make an image by executing the command docker build by reading the docker file file
Then label the finished image, push it to the warehouse, and then you can use it.
When making an image with docker build, you will start a container quietly, then perform the installation and configuration operation in this container, and then make an image of the installed result.
When making an image, you can execute some shell commands, but it is important to note that these commands do not necessarily exist, depending on whether there is such a command in the underlying basic image.
Use of variables is also supported in docker file
Define variable: var=value
Reference variable: $var or ${var}
Some advanced uses of variables are also supported
${var:-value} if the variable is not defined or the value of the variable is empty, then the following value is output
${var:+value} if the variable already has a value, assign the value to the variable
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.