![]() ![]() The RUN command is used to execute command line commands. Many applications developed in Go use this way to create images, which is one of the reasons why some people consider Go to be a particularly suitable language for container microservices architectures. For statically compiled programs on Linux, there is no need to have runtime support from the operating system, and all the libraries needed are already in the executable, so directly FROM scratch makes the image much smaller. It is not uncommon to copy executables directly into images without any system base, e.g. If you use scratch as the base image, that means you don’t base it on any image, and the next instructions written will exist as the first layer of the image to begin with. This image is a virtual concept and does not actually exist it represents a blank image. In addition to choosing existing images as the base image, Docker also has a special image called scratch. The software libraries of these operating systems provide us with a broader scope for expansion. If you do not find a image that corresponds to the service, the official images also provide some more basic operating system images, such as ubuntu, debian, centos, fedora, alpine, etc. It is possible to find a image among them that best matches our ultimate goal as the base image for customization. There are also images for developing, building, and running applications in various languages, such as node, openjdk, python, ruby, golang and so on. There are many high-quality official images on the Docker Store, including service images that can be used directly, such as nginx, redis, mongo, mysql, httpd, php, tomcat, etc. And FROM is to specify the base image, so FROM is a required directive in a Dockerfile, and must be the first directive. Just like we ran a nginx image of the container before, and then modify it, the base image must be specified. The so-called custom image, that must be based on an image, on which to customize. It involves two directives, FROM and RUN. The Dockerfile is very simple, just two lines in total. RUN echo 'Hello, Docker!' > /usr/share/nginx/html/index.html ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |