JSON formatted files are supported by Docker Compose. We’ll only really scratch the surface of what you can do with YAML.Īnother, perhaps more common, data serialization language is JavaScript Object Notation (JSON). The capabilities outlined in the YAML specification are quite extensive. When YAML is stored in a file, the file can have a. Some of the design principles of YAML are that it should be human-friendly, and that it should work with any programming language. Data serialization languages can be employed for a broad variety of programming scenarios including internet messaging, object persistence, or, in the case of compose, configuration files. I will finish the lesson with a couple special topics in Compose files. There is a lot of similarity between these sections of a Compose file and Docker commands that you are familiar with. These are the top-level element of a Compose file and include: Compose file version, services in the application, volumes used by the services, and networks to be created. Next, I will teach you about the root elements in a Compose file document. If you haven’t used YAML before, you’ll learn enough to understand the Compose file examples used in this course. I will start by giving you a brief introduction to the file format used for Compose files: YAML. We’ll start by taking a close look at Compose files in this Lesson. It’s time to start digging into the details of Docker Compose. We will complete the lesson by discussing several special topics: variable substitution and extension fields.Īt the end, we will review all of the information that has been explained in this lesson.
#DOCKER NETWORK CREATE EXAMPLE HOW TO#
We will review how to use a bridge network for Compose files through examples. You will learn about network configurations in Compose files, and how they align with the Docker network create command. We will view an example of a Compose file using the root volume’s key. We will explain the next root key in the Compose file mapping: volumes. To wrap up this portion, we will see several examples of service configurations. We will see how you would configure a container using Docker commands and the configuration key in the Compose file. We will get a little more in-depth with the configuration of the container for the service. Services: where you configure the containers created for services in your application The version string tells Compose how the contents of the file should be parsed. Version: the value for the version must be a string. We will delve into the type of mapping available in a YAML Compose file: We will discuss the Docker Engine requirements and the Compose file configurations. We will shift our focus back to version 3 Compose files. Combos: combination of sequence and mapping collections. Sequences: lists or arrays in other languages. Mappings: known as dictionaries or hashes in different programming languages. Then we will cover YAML collections and how they are organized: Booleans: indicate one of two values: true or false. Null Type: represents the absence of a value, or no value.
![docker network create example docker network create example](https://www.edureka.co/blog/wp-content/uploads/2018/07/Overlay-1.png)
Strings: a sequence of characters that can include spaces and the use of quotes to indicate the start and end of a string. Integers: whole numbers like zero or 1, which also includes negatives. Next we will look at a few basic data types in YAML: Then, we will move into a discussion on JSON, and evaluate the difference between both languages.
![docker network create example docker network create example](https://s3.ap-south-1.amazonaws.com/s3.studytonight.com/curious/uploads/pictures/1599557048-76013.png)
![docker network create example docker network create example](https://i.ytimg.com/vi/Fi9ncjzdn6g/maxresdefault.jpg)
We will start with outlining the high-level capabilities of YAML. Then we will teach you about the root elements in a Compose file document: Compose file version, services in the application, volumes used by the services, and networks to be created.
![docker network create example docker network create example](https://tecadmin.net/tutorial/wp-content/uploads/2017/09/docker-network-inspect.png)
Create Java ApplicationĬreate a simple Java File, in the directory java-application, with name HelloWorld.java containing the following content.In this lesson, you will learn about the file format used for Compose files: YAML. We shall use the name java-application 2. For this Java Example, create a directory somewhere with name of your choice. Create a directoryĪ separate directory is useful to organise docker applications.