[0:00] So, what is Docker Compose? [0:04] Docker Compose is a tool to manage multiple containers together instead of [0:09] running many [0:14] commands one by one. [0:19] So, you can create one file called Docker Compose.ml with the single [0:24] command you can [0:28] start or stop all the containers and you can manage all the [0:33] containers at a time. [0:38] So, why it is useful means one key is a time save [0:43] open the envelope and we can avoid some [0:48] mistakes also, perfect for creating environments with many services like web applications [0:52] and [0:57] database and the caches. [1:02] So, as I told you, AML stands for at another markup language, [1:07] it is a simple text format [1:12] for writing configuration files and the application law apply it want to [1:16] type of configurations [1:21] which you are on call. [1:26] So, when you run the file automatically based on the changes, the [1:31] containers will get managed. [1:36] So, data is written as a key value pairs and uses spaces [1:41] for indentations, node apps, not [1:45] it is not a scripting language, just a way to describe the [1:50] data structure. [1:55] So, example Mhu McOoo. [2:00] AML file Lopla, Evatengam [2:05] indentation is nothing but the space, so just I said hereanos just [2:09] I said this key and the [2:14] right side is equality, left side is key and right side is [2:19] value like this. [2:24] So, how to valid it, so how to valid it, let me [2:29] create instance quickly here for this purpose. [2:33] First I am going to say here Docker, iPhone Compose, right, Ubuntu [2:38] mission name selecting [2:43] here, keeper, the network settings. So, for the practice and testing purpose, [2:48] just [2:53] I am going to add one more security group rule and I [2:57] am setting it to all traffic and [3:02] the source type anywhere. So, no need to open all the ports [3:07] one by one, okay, for every [3:12] application, that is the reason, right, now click on launch instance. So, [3:17] once instance [3:22] launching in the other one or login or other, so just click [3:26] on view all instances, now [3:31] let us select your instance, click on connect and copy the command [3:36] and how to install this [3:41] Docker. So, you already know, the two I think, so I told [3:46] you, right. So, to install Docker, [3:50] we give the curl command, okay, let me open the command prompt [3:55] now. So, go to the location [4:00] where keeper is available and just paste the SSH command here, now [4:05] type s, now you can [4:10] see we have connected to the Ubuntu mission. So, just the first [4:14] command I am going to pass [4:19] your sudo apt, if and get update, to update the packages, previous [4:24] concept Sunday practice [4:29] and in videos published on my group law, previous topics and I [4:34] have a doubt, so I have so these [4:38] are lalitha karu. Now, let us install the Docker first, so the [4:43] curl command I am giving here, [4:48] okay, okay, so how to run this sudo space s, s, s, [4:53] s, get type and docker dot s, [4:58] so after installing the Docker, we need to install the Docker compose, [5:03] so it is the Docker [5:07] compose and it is a plugin and matter, right. So, warning, what [5:12] is the warning here, do not [5:17] use old GitHub, come to the end and day, GitHub link, Docker [5:22] compose new install, that [5:27] is the old method. So, always do not give any curl commands, [5:31] always use official method [5:36] for the safety and security. So, just pass the command sudo apt [5:41] update, we have already [5:46] done this one and after that, you need to give this command [5:51] to install Docker compose sudo [5:55] apt install Docker iPhone compose iPhone plugin. Now, the plugin was installed, [6:00] so how to verify [6:05] it, just pass the command, do not give iPhone here, Docker compose [6:10] version. So, it will show [6:15] you the version of the Docker compose. So, there is a space [6:19] between Docker and compose [6:24] in the new command, okay. So, if you see a version number, [6:29] Docker compose is installed [6:34] correctly, you should know if you get any permission errors, I already [6:39] done this slide, [6:44] so just you need to remember these key points, Docker compose uses [6:48] AML files. So, this compose [6:53] plugin will use AML files to define and run multiple multi container [6:58] Docker applications. [7:03] AML files are all about indentation and key value. If the everything [7:08] of our component based [7:12] on the indentation and the left side you can read as key [7:17] and right side, there will be [7:22] a value. So, be careful with these spaces, spaces are nothing but [7:27] the indentations, right. [7:32] Validate your AML files before using in real projects, install Docker compose [7:36] apt not by [7:41] downloading scripts from the internet. Okay, now let's move to the practical [7:46] part. So, we [7:51] can manage our containers together with the help of this Docker compose, [7:56] it's a AML is [8:00] a special configuration file with the Docker compose, you can start all [8:05] containers with [8:10] just one command. So, as I told you stands were at another [8:15] markup language, it uses key [8:20] value based strictly indentation spaces not tabs. AML files are not scripts, [8:25] they describe [8:29] data and relationships not actions. What is the tip here, indentations are [8:34] error indentation [8:39] errors are the most common issue only spaces never tabs. Creating and [8:44] understanding a [8:49] Docker compose file. So, open a open or create the AML file, [8:53] just you need to open the terminal [8:58] and use you can text it as you can use like Nimn [9:03] nano or vi, any text you can use. So, [9:08] in this case we have used a text editor called bin and [9:13] this is the, so just I am going to [9:17] create a file here, file m is Docker f and compose dot [9:22] AML. So, go to the insert mode and [9:27] copy this syntax. So, in order to understand this first we have [9:32] given the version, it will [9:37] tell you the format version for the compose and services next image [9:41] among services itself [9:46] under the services we have DB services means all containers are listed [9:51] under this key. [9:56] So, like you can manipulate my DB and itself. So, my DB [10:01] and my site service container names [10:06] these are and image after that what will be their image, image [10:10] name. The image name [10:15] here we are using is MySQL. So, database it is related to [10:20] and environment, iPhone E. So, [10:25] using this iPhone E option we can pass user names, passwords into [10:30] the application from [10:34] the container itself. So, we can give and assign some ports to [10:39] the application. So, here we [10:44] are assigning 50 port. So, let us say I am going to [10:49] copy the center code which I have [10:54] and just I am going to the VM editor or syntax or [10:58] whatever. So, just to go to escape I am [11:03] going to put this one. So, just let me use nano instead [11:08] of this one Docker compose, [11:13] Docker iPhone compose dot AML. So, go to let us paste this [11:18] or else let us use VIRLs. [11:22] We are using the Docker iPhone compose dot AML and again go [11:27] to insert mode. So, we put [11:32] search for that. So, I could be coordinate this one and just [11:37] click on go. So, valid AML [11:42] it will it will tell you as it is a valid AML. [11:47] Well, in case I make a valid AML and [11:51] it is syntax error same layer in two. So, just in the [11:56] terminal again go to the terminal [12:01] now press escape colon WQ7 bit. So, now let us run the [12:06] Docker this AML code. So, what [12:11] is how to run this? So, just so just in order to [12:15] start the container just you need to say [12:20] Docker compose up iPhone D. So, just I am going to pass [12:25] the command. So, you put current [12:30] location either on the current location by default, Docker iPhone compose dot [12:35] AML particularly [12:39] on the internet, this is called on the matter file name other [12:44] than the only check just Docker [12:49] well, in case file name here you may merge the unit to [12:54] you go for the iPhone F option. [12:59] So, obviously, it is asking for the permissions which were denied. So, [13:03] just I am going to [13:08] say pseudo in front of this. So, you can see that images [13:13] and pull out right. So, the environment [13:18] is getting created now. So, let us go with the another example. [13:23] So, example 2 is lamp [13:28] stack MySQL, Tomcat, Apache and PHP. So, even even in the whole [13:32] the create just now put [13:37] at how commands passes. So, if we want to go to mono [13:42] of file or pity just we are going [13:47] to run the Docker compose command right. So, we are creating the [13:52] one AML file and we are [13:56] running the Docker compose up command right. So, then give file name [14:01] let us go with the [14:06] same file. So, first of all in the mono creates in a [14:11] file either on the containers we remove [14:16] channel and the command will be Docker remove old containers the command [14:20] is Docker rm space [14:25] iPhone F and you need to pass this command ok. So, it [14:30] will remove all the old containers [14:35] ok. So, I am going in the example 2, I am going [14:40] to remove the old file instructions if it [14:44] is not on a MySQL along with that one web application we [14:49] are going to install that is [14:54] nothing, but the Tomcat and we are going to install on programacle [14:59] part that is PHP ok. [15:04] So, this is the syntax SQL API install in Docker compose ok. [15:09] Now, lamp architecture lamp stack [15:13] MySQL services under the services you can see we are going to [15:18] pull the image called MySQL [15:23] and a SQL upload monomanias now we are setting up the password [15:28] by giving the environment variables [15:33] setting up environment variables and we are going to pull up apache [15:37] web server also and [15:42] the image name here I am going to use as tommy. So, [15:47] it means the Tomcat image will get pulled [15:52] from the Docker hub and I am going to give the port [15:57] as 6060 for this Tomcat image. So, [16:01] links I am giving as I am going to link this my [16:06] DB links I am giving MySQL name we are [16:11] going to change it to my DB and here we are going [16:16] to link it to my database right. So, [16:21] the Tomcat image on a database so link just now and we [16:25] are pulling the PHP image also this [16:30] is the entire syntax ok. So, I just I am going to [16:35] copy this syntax and I am going to paste [16:40] it here. So, now escape colon wq7 now how to run the [16:45] command. So, just you need to say [16:50] Docker compose up space if and the if and e means detached [16:54] mode mono host machine no [16:59] no one term but the command will get executed and the containers [17:04] will run at the background [17:09] right. So, just let me bring up this. So, you can see [17:14] now it is pulling PHP apache this is [17:18] all images it is getting pulled from the Docker hub. So, it [17:23] is very easy process. So, [17:28] one or two times I am going to EAML file write over [17:33] just a easily you can do this one [17:38] ok. But in case EAML file in case EAML file, EAML code [17:42] write them I will you know class [17:47] I am going to make a note and it says just you [17:52] know the employee EAML code explanation [17:57] will run to me. So, just I create an EAML code but [18:02] economic example so how I am going [18:06] to I image the container sim on even the manage as known [18:11] as other just on that. So, lamps [18:16] the EAML architecture we have created lamp and they in the last [18:21] class also I told you [18:26] what is the meaning of lamp what is the meaning of lamp [18:31] ok. Enter web application key [18:35] kavasana environment anta kudha we can create using lamp architecture. So, lamp [18:40] full form [18:45] into lalthikar we have an idea on the meko. L stands for [18:50] what A stands for what M stands [18:55] very good Linux Apache very good my SQL and PHP that is [18:59] what ok. So, yes. So, after this [19:04] let us remove the old containers and let us go to the [19:09] other practical part. So, now I [19:14] am going to stop either me call it access code just go [19:19] to you can access other people [19:23] in the entire let us go to you can copy the public [19:28] IP of your machine and you can give [19:33] 60 60 port. So, let us go to the AWS now and [19:38] go back to the instances copy the public IP [19:43] of it and just I am going to paste it here and [19:47] call on 60 60 you can check whether your [19:52] application is working or not. See while in case me re-page go [19:57] to the code of the ludha [20:02] runtime Tomcat was successfully installed the application ok in your system. So, [20:07] let me [20:12] remove all the containers let me stop and remove all the containers [20:16] ok all the three [20:21] containers stopped you can see right. So, now next thing what we [20:26] are going to do means [20:31] here lamb stack completed now we can create Jenkins QA prod using [20:36] Tomcat right. So, we [20:40] can install. So, what is the version here we are giving the [20:45] version as three and what type [20:50] of services dev instance we are creating and we are going to [20:55] pull the image call Jenkins [21:00] and we are setting it up to the port called 70 70 [21:04] by default make a Jenkins task a port [21:09] may come to me 80 80 port long to me. So, we [21:14] are going to pull one more image called [21:19] Tommy Tommy is nothing, but the Tomcat Tomcat server. So, ok. So, [21:24] in a port such as number [21:28] of 18 8 double 9 ok by default it will also pick [21:33] 80 80 and after that we are going to [21:38] link this dev server to Jenkins right and after that prod instance [21:43] also we are creating [21:48] and after that we are pulling inside this instance one more image [21:53] again Tommy and here [21:57] I am changing this port to 1990 and we are linking it [22:02] to dev server Jenkins ok. [22:07] So, let me copy this entire code and its syntax first. So, [22:12] copy the command and go [22:17] to the VA editor, go to the AML file and go to [22:21] inset mode, press escape first, delete [22:26] the previous AML syntax and just I am going to paste the [22:31] new syntax here. So, now let [22:36] me go to inset mode, press escape now colon wq save and [22:41] click ok. So, just type Ls, you [22:45] can see our AML file is there here. So, just how to [22:50] run the file. So, just give the command [22:55] docker space compose space up I find D. So, you put in [23:00] your only one of the main Jenkins [23:05] there. So, how much time it was taken for me. So, almost [23:09] one hour particularly, so now [23:14] we are going to do that job for us. So, automatically. So, [23:19] it can manual effort, there [23:24] is no manual effort at all right. So, just press enter now. [23:29] So, it is going to pull the [23:34] new server. So, simply you can access each and everything. So, just [23:38] me room a instance [23:43] of public IP is contour and whatever the port numbers you have [23:48] given for those applications [23:53] you can directly access them into your browser. So, just go to [23:58] the console, just copy the public [24:02] IP of the instance now. So, I will work out now a [24:07] lecture now. So, I am on Jenkins port [24:12] number even the school number, 70, 70 and each other. So, just [24:17] open the chrome browser [24:22] just paste the public IP and I am giving colon 70, 70. [24:26] Now, press enter see the Jenkins [24:31] is going to ask you for the password now. So, Jenkins work [24:36] out from there. Next time [24:41] the chammono or Tomcat in KI. So, now, let us copy the [24:46] public IP of our instance. So, [24:50] you can see check all the containers are running or not. Just [24:55] give the comment here [25:00] Docker container. Alas, it will list out all the containers. See two [25:05] Tomcat server, Tomcat [25:10] of our publications are running right and one Jenkins was installed in [25:15] the dev instance [25:19] right. So, now, let us try to access it and I am [25:24] going to chammono. We have assigned it [25:29] 80 at 90, 70, 70, 80 default together, 70, 70 chammono. Now, [25:34] call on 70, 70. Okay, Jenkins [25:39] has a successful run out may no problem at all and what [25:43] about the Tomcat, double 8, [25:48] double 9 and 90. Okay. Now, let us go to console and [25:53] go to check the proper go panjas [25:58] let us pass double 9, double 9 Tomcat application should get. [26:03] Oh, he taught me. Okay. 80, 80 portal on the bar. The [26:07] 88 double n again. [26:12] Go to insert mode and what is the example for here, the [26:17] syntax. [26:22] Copy this syntax, go back to terminal, just paste it. Now, press [26:27] escape, WQ save and [26:31] click it. Now, let us run this containers. So, how to run [26:36] the container? Just you need [26:41] to say Docker compose space up, I find D. Now, it is [26:46] pulling all those images and we can [26:51] access it giving the, what, double 4, double 4, 5 9 0 [26:56] 1 for V and C and 5 9 0 2, Firefox [27:00] image was pulled from container started. So, just use the command Docker [27:05] containers [27:10] LS to see all the containers they are working fine or not. [27:15] So, now, let us copy the public [27:20] IP and test all our applications are working properly or not. So, [27:24] what is the first port? [27:29] Double 4, double 4. So, just give here double 4, double 4, [27:34] the center. You can see Selenium [27:39] grid interface successfully and next, what is the next port? On spatical [27:44] port, type in [27:48] the router, just remove all the containers. To remove all the containers, [27:53] just pass this [27:58] command. So, network, I will check, check, check, check, check, check, check. [28:03] So tomorrow [28:08] class I will tell you, I will go time to troubleshoot it. [28:12] So, all the containers stopped [28:17] and you can stop your instance also. So, there are doubts on [28:22] the aragandic glass law, [28:27] later on, I will add this session. No, it's not flat, it's [28:32] just him. Please do practice.