How to Run Nginx Docker Container? 🐳 (SSL | Ubuntu 20.04 | AWS | EC2 | ECR)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today i'm going to show you how to run engineering docker container first of all in the first 10 minutes we're gonna run it locally we're gonna create very simple docker file then we're gonna create the html page and nginx config and the config for our website and then we can run it locally on localhost 8080 and you can follow along i have the blog post and also you can find the quote in my github repository the local part will take the first ten minutes and then we're gonna continue in adws and we're gonna use our self-signed certificate that we created in the previous lesson however you can use your own certificates and we're gonna run it inside the docker container but inside the adwsvpc on ec2 instance all right the first section is build and run enginex docker container locally the first thing that we cannot do is to create the folder all right let's create the nginx folder we're going to place all the files including the website docker file and nginx configuration right let's create the nginx folder and well since we're going to be running nginx inside the docker container we need to create the docker file where we define the steps to build the docker image however you can use the original docker image for engine x and run it that way as well but this is going to be the more cleaner way to build your own engine x based on that nginx open source image all right so let's go ahead and create the decker file and docker file just the naming convention you can call it whatever you want but the naming convention docker file and the first thing we're gonna do we're gonna use the from statement and we're gonna start with the base engine x image and in order to find the latest version we can go for example the docker hub amazon aws have its own uh public repository but i'm gonna still i'm gonna be using that um docker hub all right so you can go to docker hub you can search for nginx and then let's scroll down you don't need to sign up you just need to find the version that you want to use i want to use the latest one which is 1.19.8 that's the one main line all right so let's go back to the code and create the from statement all right so that means that we're going to be using this particular image as the base and it will include all the files everything and that or this particular nginx contains so that's going to be the base and it's going to be single stage so we don't need to give it a name or anything like that all right so this is the first step now well let's go ahead and create our super sophisticated website html page so let's go ahead and create another file it's going to be index html that's most by most of the services this particular index.html used by well that's the naming convention as well and you can call it whatever you want you just need to adjust your nginx config later on we're going to call it nginx.tmhtml and let's create our page all right so it's going to be html page and then inside the body we're going to put h1 tag and open and close and put our well website name devops by example and that's going to be pretty much all no javascript nothing just one single but however you can include but just to simplify this lesson i'm just gonna be using one single uh header here all right so this is our website now we need to copy this website to our docker image and you know to do that we can use the copy directive inside the doctor file and we can use the copy command and that's going to be the index file which we have locally on our well computer laptop and on the right hand side it's going to be something inside the inside the docker image so that's going to be on the left hand side the file in our directory and this is going to be inside okay so in that way we're gonna copy index inside the docker image now let's go ahead and create the very simple nginx configuration for our website let's call it devops by example.config and let me copy and paste all right so like i said it's going to be very simple so it's going to listen only on port 80 only for ipv4 no ipv6 and the server name will be localhost so we're going to be running this locally and access localhost also we're going to define the root directory when we get access just the localhost slash it's gonna go and find this is gonna be the root directory so that's where we place our file inside that folder and here we're gonna say that this folder is the root directory where it needs to find everything so if you're not going to specify index.html and index here uh it's not going to give you this page so you need to define what will would be the like default web page for slash for the root okay and that's going to be the file that will be located in this folder and of course we need to copy this nginx configuration file inside docker so let's do that and we're going to use the same copy command then we're going to say what kind of file we want to copy and then the direction uh and then the directory where we want to put it so by default that that particular file will contain this it already has the nginx installed right and it has the etc engine x conf d directory where we're gonna place all custom configuration files so by default and i will show you later it will search for all nginx configuration files inside this folder and it will apply them so that's why we need to put it in this folder and also well that's pretty much enough but i want to also show you how to rewrite the main configuration file so let's go ahead and create the nginx.conf and that's going to be our main configuration file for nginx like the entry point and let me close this so it's like i said it's default you're gonna this is completely default except the last line so this is whatever comes with the default nginx you'll get here and user and bunch of other stuff and access log maybe you would be interested but i'm not gonna go deep in all those directives and commands etc the only part here i updated that include statement included means it will include all other configuration uh files for nginx and that's going to be the path by default it uses the star instead of this and it will include default and some other stuff so i don't want it i just i know that the purpose for this particular container image and i want to know exactly what i'm gonna include in my configuration file so i'm gonna hard quote the configuration file that's the one that's exactly the same that we copy pasted here inside the docker and i want to say that include only one single file and it's going to be predictable for me at least i know that i'm not going to get any surprises right so this is the main config and this is such as the import inside this config you can define this block server block here as well instead of include but that's just the convention how you can split your large nginx configuration files into small files using include statements right and let me close this and devops all as well and the last file that we want to copy here is the nginx config so that's going to be the local file that we created here and that's the place the default place where nginx will look for that file all right and now let's go ahead and build our docker image let me go to the terminal and type docker images and i don't have any docker images right now so let's go ahead and build it and well important part here you need to change directory to your well context where you have all your files so since we created them since we created the nginx directory we need to switch to nginx directory and then run the docker build and then dash t that's going to be the name of the image and this is going to be the tag and the dot at the end will represent the direct current directory so for example in the docker file when we say the dot at the end it will consider this particular folder root folder and we'll look those files inside the current folder like this represents the current folder where we in nginx and let's go ahead and build it so when we're going to build it it's going to download the engine x from the github first and then copy those files inside it all right now it's done let me list docker images and now we have the open source default base image and that's the the one that we built it's pretty much the same size since we just copy a couple of the files but different uh tag and now we can well run it locally it's very easy to run it locally so let's go back you can run it from anywhere you just need to use the following on docker run dash p will map the ports this is going to be your local port on your laptop and 80 will be inside the container and we know that by default it's going to run the nginx will run inside the container on port 80 and we don't want to run it on port 80 because of the conflicts you can just pick any random port here by and just use that one doesn't matter on the left hand side and here just the image name and this is the tag which we just used here and let's run it and also we're gonna run it in foreground so if you're gonna add d it will run it in background but we just want to run it in foreground and all right so now we have the nginx running we can go and access let's go to the localhost 8080 and we can see our website devops by example and that's nginx well index.html that's exactly what we're gonna get here all right that's the first section how to run the docker container locally the easiest one the second section will be how to run it inside well with the ssl certificate and inside the adwords so in the previous lesson we generated the self sign certificate to secure our nginx and you can use you can either generate your own certificate but if you planning to host your website on internet and other people will access it you not going to be able to use the self-signed certificate you need to get it from let's encrypt or from any other provider but you can still follow this example just gonna get gonna use your own certificate right now let's go back and secure on nginx so let's change our configuration for devops by example here so right now it's listening on only on port 80. let me replace this and let's go over it all right so let me start with the second server block and it's going to listen on port 443 and it will enable ssl then we're going to provide the server name this is your dns name so i'm going to be using my like apex domain which is the the optimal example that i o and then sub domain as well so i want to use those two domains then i'm going to specify where my certificate located later on i will create the hc2 instance and upload my certificates in search directory and this is just the path to those files so in order to run with ssl certificate you need the ssl certificate and of course you need the key so we're gonna put those two files also by default um those are default values for this particular version the tls security encryption what kind of ciphers do you want to use it's uh option well it's not optional but it's you can update based on your uh security requirements for example if you don't want to support tlsv1 or v1.1 something like that or maybe you want to support uh older versions of cyphers well cyphers here actually uh those are the protocols so based on your preferences you're gonna update um your protocols on ciphers based on your requirements from the application standpoint and those are default wallets if you just want to run the website that's going to be perfectly fine you don't need to update anything and here the same pretty much location root and this is going to be exactly the same thing so we have the default folder which is the root and then the index which will point to them the website that we just created and the server on the top since this um nginx container will listen on two ports on port 80 and port 443 we're gonna automatically redirect any client that will access port 80 or using one of those domains it will be redirected to the portfolio immediately so all the communications with our server will be secured and through the ssl so this is just redirect to point to this block and that's pretty much it so listen to port 80 the same server names and just redirect here all right the next step is to start working with adwords so we need to the next section will be let me go back to the block and we just finished the first section now well and this section as well secure nginx with sl certificate now let's go ahead and uh create imuser ecr and push this docker container docker image to ecr all right let's go to aws and let's create the private ecr repository to hold our image let's search for ecr which will be elastic container registry let's go there and then if you don't have any you probably gonna click on get start if you already have it you know what to do and just click new one so it's gonna be private we're going to call it web this is going to be just our account name and this is the region and we're not going to change anything else just that and let's click create repository all right so now we have them well private ecr repository also let's uh right now my assumption that let me stop this docker and you can also see all the logs when we access it locally let me stop it right now my assumption that you don't have the aws i'm user locally configured and we're gonna configure your user to push your image to otherwise so pretty much be doing everything from scratch all right so let's go ahead and create the group first that's the best practice to use them groups attach policies to groups and then place your users in those groups let's go to the groups i'm groups and let's create a new group and let's call it ecr admin and it will allow those users to pull push images here well we can probably create our own policy but just to change something let's gonna use one of those uh existing policies that adws provides those are existing and provided by aws let's search for amazon ec2 container registry power user and well like i said you can grab all the commands all the names from here from the blog post it's just sometimes it's easier just then type that's that's going to be the amazon is to continue register power user policy that we're going to be using all right so that's the one and let's select it and attach this policy to our im group all right so that's going to be our im group with that policy and let's create the developer user and we're going to be using that user locally from the terminal to upload to push our docker image to ecr let's and i don't have any users right now and after this video i will delete it this particular user as well so we're gonna give it only programmatic access next permissions and here the first thing we can place this either in admin or ecr admin that we just created and that's the name of the policy you can give or you can attach some tags but i'm going to do that and let's create that user when the user is created you need those credentials and well let me download credentials i'm going to be using those later on let me close and close that as well now like i said before one of the prerequisites is to have well for the second section you need to install adobe cli and this is the installation gate guide if you click on this link for windows linux mac etc so i i already have my assumption that you already installed that adversely already have it so now well in order to configure the user there are multiple ways you can either use nbs configure or you can use environment variables etc so drop or well there are multiple ways how to configure users and we're going to be using the the one the simplest one and obvious configure now when we run this command we need to enter our key id which will be we just downloaded that file that's the new user credentials file and let me grab the [Music] the id first go back and let me enter it the second one is access key and let's just key the second let me enter it and default region name well i'm going to be using this usd east one i believe it's a virginia right all right let me skip and default those are two optional values you don't well region probably you need to enter it but here json just my preference that i want to get output in json format all right so now we have the we configure the user locally now we need to upload our docker image to remote private ecr repository in adws and the easiest way to do that go to aws and let's go to ecr again ecr elastic containing register and this is our registry web that we just created and to do that let's click on view push command and it's going to give us a bunch of different commands and let's use the first one to authenticate your docker client to your registry and this will only work after you configure the user locally or export environment variables let me copy this line go to terminal and let's run it and we can see that the login succeeded and i believe by default you can get this temporary token for 12 hours something like that maybe less but it's not gonna be permanent so you're gonna be you're gonna need to relog in sometimes all right the next step they saying that we need to build we already completed this step then we need to tag our image with the this particular well with our this is going to be my account id and this is the region so you you're just going to grab this but instead of the latest we're going to use well our tag so it's going to be zero one one oh actually let me build it now we've never built it right so let me before we gonna be able to upload it let's go back and here we updated this um configuration file for our file but we never build a new image so if you go back to the terminal and type docker images we have only one image the one we listen on port 80. now let's go ahead and build the second one build and let's just use the the second well one at the end and let's build it so this zero one one will be secured with the ssl certificate now we need to attack this image let me target and like i said this commands comes from here so we just need to target with our ecr credentials for account and region all right let's target so it's going to be the web and this is going to be this the the one that we're going to upload let's target and then let's push it all right so let's gonna go ahead and push that image it's gonna take some time all right so we uploaded our image let's go back to nws let's click close and refresh this page and we can see that we have the our image uploaded all right the next step will be create impolicy and i'm roll for ec2 instance first of all let's go ahead and create the i'm policy let's go back to i am click on policies and let's create our own policy and under the json we can enter well our custom policy all right so it's going to be here it's quite long and you can find that policy down below here that's gonna be the the one and we need to make some changes here so the first one statement here will allow the client to dock your client to get the authorization token and authenticate with the ecr the second statement manage repository contents so well it will allow to pull image and under resources you can either use star but i would prefer to grant a permission for single repository that we just uploaded and you can provide it here so here you need to replace the account id and then the web i guess you're going to be using the same one and is in the same region but account id will be definitely different and to find out you can get it from here so that's going to be your account id all right and let's click next and review and let's give it a name it's going to be long name just following the same naming convention that aws has so it's amazon ec2 container service web read only access and let's create the policy now let's go ahead and create the role so well if you want to use those roles with the ec2 instances you need to create the instance profile but for example if you for here under all create role if you create the role using the console the aws will automatically create role and instance profile for you with the same exactly name but if you're using something like teraform or cli you're gonna need to create those two uh entities differently separately so keep it in mind so through the console it that's going to give you both ec2 instance let's create the row for easy to instance this um particular ec2 instance we select that this only ec2 instance will be able to use that permissions let's click next and here let's select our policy and we can filter by customer manage policies and select the policy that we just created select it next tag next review and let's give it a name and let's call it pull ecr images and create draw alright so we have the role now and also easy to instance profile alright so the next step is to create ec2 instance and attach amro let's go back to adwords console and let's go to ec2 and first of all um like i said since we're gonna be doing everything from scratch first of all we need to create the key pair and this key pair will allow you to ssh to your instance there are multiple ways how you can ssh but this is one of the way the most common one and let's go to the key pairs and let's create the key pair and call it devops and let's keep it default file format and click create and it will download the private key locally so we're going to be using that key to ssh and let's go ahead and update the permissions on that key so let's go back to the download folder now we have them devops and and we can use well we can use the following command arch mode then the permissions and then well the file and we're gonna go list again so we just updated permissions to to this to the user itself that only that user can um the owner so this is gonna be the owner of that file and this user will be allowed to read and write and right before that i think this is the the group that uh stuff that allows to allow to read and this is the read other so basically everyone can read it on my laptop and we just restrict it right now to the only this user okay so now let's go ahead and create the security group that's kind of firewall in nbs let's create go to security group and let's click on create security and let's call it just web and for description we can give allow external access and select our vpc here and let's add multiple rules so the first rule since you want to ssh let's use ssh and here you can either well this is not very safe method but you can use the all ip addresses all source ip addresses can ssh or well it's not very convenient but in this case you can go get your public ip address and use this public ip address or another way if you have the like bastion or openvpn you can use those as well but for simplicity we're going to use the all source ipaddresses we can give description i would say i encourage you to give the script description button i'm gonna do that then we're gonna allow port 80 which is http and it will redirect to well 443 and same thing from everyone will be allowed to access and same thing for https https and everyone alright now we have the security group and this is outbound trolls and we allow all traffic from everywhere to everywhere and let's create security group okay now we have that secret group and let's go ahead now create these two instances let's go to ec2 and you can go with their instances so click on launch instance and then we're going to be using ubuntu let's search for ubuntu and let's select that 24. select the first type is the instance type and let's use the t2 micro here we're going to say one instance then network or well let me before we gonna create this let me just show you what kind of epc we have let me open it again so let's go to vpc under the vpc i have one vpc which is not default i deleted default one and created my own it's not default vpc then i have only one single subnet which is the public subnet and the public because we have the route table and the default route will lead to internet getaway so here for example we have the i created the second route table which is the public with that particular route here default route to the internet guitar and under internet gateway you can find it now let's go ahead and create that ec2 instance let's go back and here we're going to select our vpc single one then we're going to select the public subnet and also we need to have the public ap address here and in this section you need to select enable and that that easy to instance when you create it it will automatically get the public ip address let's click add storage and here well let's keep let's just keep default it's going to give us 8 gig of disk and let's go back then tags you can add additional tags and security group under security let's select the one that we created which we called web all right and let's click review and launch and here that's looks good and launch and we need to select our um key pair so that's the one that we created devops key pair lunch so it's going to take some time to create well right now it's painting maybe few minutes it's going to be fine and the next step will be we're going to install docker so that's going to be the next step install docker on ubuntu 24 let's wait till it's up and then ssh let me close this to that instance and install docker and we almost done all right it's it's running state let's go back to the terminal and let's ssh and in our ssh you need to [Music] run well ssh then dash i you will provide your private key and we have our private key in the downloads folder and then we we need to use the default user for ubuntu ubuntu and then we need to grab the public ip address from that instance from here let me select it expand and that's going to be the public ip address let's see that one and let's ssh to that instance and let's say yes and all right we inside that ubuntu now let me just quickly and that's going to be the following commands here that we're going to use to install let me do it quickly uh to install it all right the first one will be we just need to update the repository so the upped update all right the second one will be to install necessary packages this one will add the gpg key and then we need to add the repository up add up to repository with that docker then we're gonna go ahead and again update the repositories and we need to select that we want to use the [Music] verify that we're going to be using docker ac which is the community edition ee means enterprise edition so let's select the community edition and let's install it and that's why it just says that it's gonna apply it's not gonna wait for output from us to say yes i want to install it all right now we have the docker let's check the status well let me just show you the command that you you're gonna run which is the solar system still status docker and we can see that it's in raining active running uh active state all right but you're not going to be able to use it let me show you if you run the qrps most likely you can get permission denied because you the this user who am i who who am i ubuntu is not in that docker group so in order to be able to use it you need to add your ubuntu user to the docker group and this is just environment variable represents exactly the same thing ubuntu let's edit and let's run the qrps and it's not gonna work and to make it work you need to log out from ubuntu and ssh again and let's run docker pass and now it works images all right the next step is to upload the certificates let me show you the next step well the next step the next section is run enginex docker container with sl certificate we're gonna upload those certificates and i'm gonna show you how to run it and we're also gonna create the docker compose file let's go back to our ubuntu instance and let's create here when we ssh we got to this directory which is the home directory for your current user and let's go ahead and create the folder certs where are we going to keep our certificate well certificate and the private key and here well we can even move well maybe not just let me list all the files insert and right now i don't have any now let me move to the lesson okay and well oh like i said um in the previous lesson we generated our self signed certificates but you may use your own certificates which were issued with the let's encrypt or any other provider so since i have those uh generated certificates um i'm gonna well let me list it's gonna be in the lesson the previous lesson which is 0 54 and also the certificates so this is the the certificate and this is the private key and we're going to copy those and move them well copy to the ubuntu server and we're going to be using the cscp command secure copy command and that's the command this is the dash i pretty much exactly the same parameter that you would use when ussh you will provide your private key to be able to ssh and when you do that then you're gonna the first argument that's the first argument will be the local file that you want to copy and the second argument will be the remote target so that's going to be the user and instead of that ip address we need to use our own ap address from that ubuntu so that's the one and then column and then provide the folder where you want to copy that file let me run this command all right so we copy the first file and then let's copy the second which is the key it's gonna be the key right that's the one the key let's copy that as well let's go back to ubuntu and let's list the files now we have the certificate and the private key in our folder well in the search folder all right now we can actually that's it that we can run docker from here and i'm gonna show you two ways the first way we're gonna use the since we already installed the docker we're gonna use the docker run g to run it in background p map ports so we're gonna pop map the first part and the second part so we're still gonna access all the connections on both ports and we're gonna redirect from port 80 to port 403 then there's v stands to map volumes so the first argument that we that's the basically that's the one it will tell you map local ubuntu directory home ubuntu search to the docker image and this part etc engine excerpts this is the directory inside that docker image and the the way we know that because in our configuration file let me open it up in our configuration file we specify that we're going to be using those certificates and we place them to those folders and we need to map local to docker image docker container volume in order to use those so those certificates will be located locally on ubuntu not inside the docker image all right and then we just gonna provide the image and let's run it and well we need to authenticate right so we're not gonna be able to run it right away and that's uh and also here let's go back to adobe's console and we also need to actually let me show you so here let's go to them well let's go to ecr let's go to ecr and then let's go to the private ecr image and let's click on view push commands and let's use this command and let's try to run it this the first command to authenticate and well it's not going to work first of all because we don't have the adobe yellow install let's install that now let's click yes all right so that's the first part we need aws cli all right let's try again let's copy well let's view push commands and let's try to do that again authenticate and now we're gonna get well it's not configured and we have the error and if you even configure ws well what kind of user you're gonna be using to configure it right so that's one of the problem you basically don't have any permissions right now from this ec2 instance to access the ecr and in order to fix that we need to go back to [Music] ec2 click on institute and let's go to running ec2 instances and that's the one that we created right and right now if you scroll down and you don't have any roles instance profiles attached to that ubuntu so that's why you can pull any images all right to fix that we can click on actions then let's go to the security let's expand it and let's click on modify i'm roll and now we can attach our i'm roll and that's the well technically it's the instant profile and since we created through the the boost console role instance profile have the same name and let's attach and let's save it all right now it's saved and let's refresh and let's close this and now we can see that i am roll we now have this uh instance profile that has ability to access ecr images okay so if you're gonna run it immediately you may still get an error so sometimes it takes few seconds to update the cache and all of that so let's try it oh so now it works okay so the second time we got the we don't even need to configure aws configure so since we attached that instance profile roll to our ac2 instance we are able to login and now we can pull images and use those private images from ecr and to do that let me go back to my previous command docker run and let's try to run it in background and now it has access it's pulling the web image all right and it started it and [Music] let's clear clear and then type drps and we can see that we have the one running docker container and to verify it we can go well we can well right now we are running inside the nws and we have the ip address but we right now we're not going to be able to verify it's working or not because in server name section we specify that the engine links will wait i will only use those tns records so it's if you're gonna use the ip address let me even show you so right now if you go to the https or http and enter the ip address so you're not going to be able to access it and of course you're going to get the error and this error will indicate that the certificate is not trusted that's the default certificate and i'll show you how to fix this and this is only because of the self-signed certificate all right so it's going to redirect and it's going to ignore it anyway so now we need to create the dns records and let's go i have my google the mains i have my dns hosted there let me click my domains then let's go to the devops by example.io click on dns and this you just need to create your dns record doesn't matter where you host your um domain so you need to create two records so since i'm going to be using those two records i need to create the for apex domain and then for subdomain all right so let's do that let's use the ip address please ap address let's enter the ap address and let's use just five minutes to tell and that's going to be the air record let's create it okay and the second record will be the same ip address but it's going to be for sub domain for www and let's click it as well just miss all right now we have those records and i think we can close this and even that and to verify those records we can can we use here and s look up do you have this command here yes we do we can use it here ns look up okay let me exit well let me use it here and let's look up and then i'm gonna use the nsl cup to get my um api oh well ips for this domain and well i already have access and let let's check for subdomain all right so it looks like it's working now i can grab this domain and then go and open new tab and let's do https well too many slashes all right let's see all right so now well if you click advanced headlines okay so now the problem only because of the uh that it's self signed certificate so you're not be able to the the browser doesn't know doesn't trust it and most of all all other clients all other well people for example who are using and want to access your website will not be able to access it they all gonna get some kind of uh error unless you're gonna use the certificates from the one of the let's say encrypt or any other certificate authorities that are trusted by all the browsers and this is only because of you we are using the self-signed certificate and in order to fix it we need to make this browser trust our certificate right now well let me click on certificate and let me click on details click on details and this is our certificate and like i said in the previous lesson uh this field is depreciated and the most important fields are the alternative names those two so those two have to match your dns record and the problem that we are facing right now is because it was issued this is um the ca certificate authority and it was issued by my own so in the previous lesson we generated certificate authority and we uh used that certificate after it to sign and generate this certificate and what we need to do for self certificates we need to upload the ca to the well our laptop in my case and i'm on mac so in order to do that you can go to keychain on the mac and most likely on windows on ubuntu or on linux you can do similar things but i'm going to show you on uh on mac you just need to upload your ca you can google it how to upload ca to well whatever you're using on mac it's gonna look like this so you're gonna open the keychain and then you're gonna click on [Music] import items and pretty much you just need to import your ca and this is the ca that we generated in the previous lesson self signed cd and we just need to import it let's click open and that's the one and also we need to double click and then under trust we need to set it to always trust and when you close it it will ask you for your password all right now it's trusted let's check it let's close it and let's refresh it right now it's on internet and well it's trusted it's wild certificate you can see that it's wallet however it's self-sign and under details it's pretty much the same and well it's going to be exactly the same thing if you're going to use www so it's going to just redirect well it's not even a redirect since we don't have those rejects but if you're going to use for example instead of http i mean https you're going to use http it's going to redirect to https all right so that's all and the last thing i want to show you the docker compose file so right now let's run let me just exit and ssh again to our ubuntu and then run the qrps and let's stop it docker stop and then this is our id let's stop that all right look here ps we don't have any and let's refresh and it's gonna fail right so since we're not running anything and well when you use just docker run command um you need to provide all the arguments and i'm gonna show you another way to use docker compose and in that docker compose you also can specify that if for example it fails it can restart it all right let's quickly create docker compose let's use vm create docker compose and let's create that docker compose so it's going to be just yaml definition and here on the services we're going to define the first service and single one we're going to provide the image that we're going to be using then we're going to say if it's fails it will uh somehow exits the container it will will be restarted always then we're going to map the same parts and volumes it's going to be exactly the same thing but now you can define all your arguments inside the docker compose and to run it and well of course we need to install it install docker compose and to run it in the background you're gonna say docker compose up and d to run it in background and let's check the qrps and you can see that it's running now let's go back and refresh and you can see that it works now all right thank you for watching and please if you think this is helpful subscribe to my channel and like this video thanks bye you
Info
Channel: Anton Putra
Views: 8,922
Rating: undefined out of 5
Keywords: run nginx docker, run nginx docker container, nginx docker tutorial, nginx dockerfile, nginx docker image, nginx dockerfile example, nginx docker compose, nginx docker reverse proxy tutorial, run nginx container, run nginx locally mac, run nginx ubuntu, docker nginx tutorial, docker nginx ssl, docker nginx website, devops, sre, anton putra, docker, nginx, ssl certificate, docker run nginx, run docker nginx container, self signed certificate, docker compose tutorial, docker run
Id: 7isa-1VC6pY
Channel Id: undefined
Length: 58min 57sec (3537 seconds)
Published: Sun Mar 21 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.