Example # 02: Multiline Comment in a YAML File in Ubuntu 20.04 In the tenth line, we have added a single line comment using the “#” character, and this comment is used to define the network property of the Docker image. In this example, we have used the YAML file as the compose support file for the Docker image file, and the script used in the YAML file defines the general flow of the Docker file.Īs we can see in the previous snippet, the file has several different definitions of variables like version, services, and other configurational files. We can open the file on the terminal and in the text editor, where we can edit the file. After this, if we locate and open our directory, we will see the files we created in our current directory, as shown below: To generate a YAML file in the same directory, we’ll use the “nano compose.yml” command. The “mkdir” instruction will create a directory, and the cd instruction will direct us into the directory. We will use the following commands to create a directory and then open a compose file in a similar directory: In this directory, we will make a Docker image file and a Docker-compose YML file. In this illustration, we will be naming our script “app1”. We will start with creating a directory on our desktop using the “mkdir” command. This file will be created in a directory of our Ubuntu operating system. We will be making a compose file for the docker image file in the “.yml” format. In this instance, we will form a YAML file with a single-line comment. Example # 01: Single-Line Comment in a YAML File in Ubuntu 20.04 The pre-requisite for the implementation is to install Dockers and Docker-compose through the Ubuntu terminal. In these files, the configuration of a Docker image file is stored. The Docker-compose supports files with a “.yml” file. For this article, we used the YAML file as a support file for Dockers. Now, a YAML file is a configuration support file for storing data for other programs like Ruby and Dockers. We can use the single-line comment multiple times to make a block comment paragraph in the YAML file. YAML allows single-line comments with the help of the “#” character. In this article, we will be discussing the concept of creating comments in a YAML file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |