Docker compose tutorial for beginners by example [all you need to know]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome back to my videos today we will learn about docker compose so in this video what you will learn you will learn what docker compose is you will learn how to use it in your projects and what is the role of docker compose in the darker ecosystem and then we will build some examples and see certain aspects of that gherkin for certain options and stuff what you need to do in your projects you know to get up and running with either compose I will also point you to some resources online that are key and are provided by many by darker that you can use as a reference for your everyday work and I have written a blog post about it that was published I think yesterday and it's about 6000 and 200 words and you can check it out there's a link below this video to that blog post and you can use it as a reference anytime you can return to it and read it whatever you like so what you see here on the screen is basically the agenda from the post online this is from my blog and this is the table of contents of what we are going to learn today so first I will tell you about the dagger compost ecosystem the definition of docker compose then we will you will see the the command-line options and and some use cases we will see how to build images with docker compose we will see how to run applications with docker compose and then we will see how to define networks how to define volumes and use them with docker compose and then again we will use we will see some other options like variable substitution that are handy in everyday project work and let me check what we what we also have here we will have some some details like had to run commands in in containers the docker compose and how to scare services because you can do that as well and in hardware you can use override to dr. Campos 5 so you can use multiple campos files in your project so we going to cover all of this and we will use examples to do so so let's start with the definition of docker compose what is that be composed dr. Campos is a tool provided by darker to build and run multi container applications so if you if you're not very familiar today with containers and images please look at the previous tutorials because though that knowledge is needed for for today so dr. Campos is a tool that we can use to build and run multi container applications docker compose comes in two forms one form is the docker file a docker compose for head story and I will show you an example in a minute so one form is a compose file that you can use to define your application and hire services in the application work together and the other form of docker compose the other manifestation is the docker compose command line command that you can use to build a stack to startup the stack and so on so if you look at the screen now if I do like docker compose in the comment line that you can see that the docker compose command has some options and it has a set of sub commands that you can use and we're gonna see these in a minute so I will explain everything with an example and before we move on I want to show you a practical example a working example very quickly so that you can have a better picture and then we could big-big on a deep dive so what I prepared here is just very simple a wordpress stack that consists of two services and i'll show you how to use a campos file to do that so we don't we are not doing any special thing here what we are doing is we are taking the official images and see how we can start up a wordpress stack with a single command so this is a compose file here this is your first compose v if you're not familiar with docker compose already so this is the first compos fight that you see I think what I would like to highlight right now is the is this section here which contains the services and services are basically the components of your architecture and that means that every service in a compose file can be associated with exactly one docker image so if you are decomposing your your architecture into into various images like one image for the database one image for the for the backends another one for the front-end server an api gateway or you may have many many components so for each and every components where you think that I want to create a dedicated docker file and dedicated custom image then the best thing would be then to use the docker image in in a docker in a service in a compost file so you can associate immediately service with that image is sort of a simple rule of thumb and in this compost why has two services one of them is WordPress and the name this is the name of the service this is a custom name so I can put anything I want here so I can put like WordPress 101 or whatever or my WordPress whatever I like so I give a name to this to this to this service and then I specify what image to use this is the official WordPress image I can specify some environment variables that will be passed to the container the docker compose will start up for us then I define my port mappings here I'm mapping port 80 from the WordPress image to the local machine and I define networks and volumes this means that this WordPress service or the container that will be started from this image as part of this service will be connected to this network it is a custom network that I define and you can do this in compose you will see we when we scroll down and I define what are the volumes that this image is using similarly I have a my sequel service here which means a sequel with my sequel official image I have some environment variables oh by the way this is not best practice so you don't put your stuff in here I will show you some practices how to hide this and it is attaching to the same network so that these things can be connected and it uses a another volume to store the data so in the Services section we have described the components of the architecture and how these components work together I think the great there's a great role of the network section in this because you define your custom Network here so I have defined one network that I called WordPress net and I define the two volumes that are used by the two services separately so this is describing a working WordPress stack so if I just go back to my terminal here and switch to the developer this is the purpose official this is the same directory with one darker campos file so this is one compost site this is by the way the default name of the compost file so if you call your compost by docker compose - compose dot yml then docker compose the command will pick it up automatically so you don't do the need to specify fine name this is before filing so if I go like jacker compose up and - d means that it runs in as a daemon in the background then it will take the compost file and it will create the network that is specified and it will create two containers and my wordpress stack is up and running so then I can use commas like docker compose locks to see what's going on and it seems that we are ready to take connections so let's go localhost 8080 and you see WordPress is up and running I can go on with my configuration and you know I can I can do the installation right now it's a working WordPress instance and that the point is that this tag or this application container consists of two different services and I use a compost file to define these services in a single file so this is basically the idea behind docker compose and we are going to build another example here but before we do that there is one very important thing that I would like to explain to you now that you know the docker compose has the Campos file it has the command line command called docker compose and you can use the compost fight to define multi continue applications then we need to identify I understand the limitations of docker compose and it works like this is it's pretty simple but it involves some sort of darker history so the containers and images were created first by docker and the dr. Campos was created to put multiple services into one stack and started up with with one single command the limitation of docker compose is the docker compose works only on a single machine so this means that if you are using docker compose you can run your stack you can run your containers on one single host machine only you cannot run docker compose one on a computer cluster and you cannot distribute your containers or multiple contain not much more computers with docker compose that is a great limitation and docker has another product called a curse warm and supportive swarm is the orchestration solution provided by dagger so if you wanna run your application stack on a computer cluster you need to get familiar with darker swarm okay so compose single machine swarm computer cluster so now the question is why would I use docker compose and I can give you a Bible you learn docker compose anyway so I'll give you two reasons first reason is that the compost file is used by docker compose on a single machine and the same compost file can be used or is used by Dockers swarm on a computer cluster so you can use the same compost file both on a single machine compose scenario and in this moment in a cluster a swarm scenario which is very handy so you need to learn the compost fine anyway and the second reason that I want to give you to learn dr. Campos is that you will use docker compose in your development cycle a lot so you define your compost by then you want to play with your stack you don't want to start up a swarm immediately you just want to you know go go to a single machine and work like that you can definitely do so and we use I think docker compose most of us I use docker compose personally a lot when I'm when I start a new project or start to work with something so so that's why you probably want to learn docker compose so let's start building with docker compose and see what it does I have prepared another example for you it's a Python application that I created these are the files that you can see here so requirements txt is the is basically just the Python packages that are required by this example so it's flask and Redis we're gonna build a flask application that connects to Reddy's datastore and then we're gonna add some data and retrieve some data and this is what add PI does and but I don't want you you don't need to understand everything in detail but it's quite short so this is everything so I'm importing a flask and Redis here I'm creating the the application instance then connecting to Redis we will look at this line later had Hadi other components are connected it's an important point and then we are defining one route here and they can get post and get requests and and this is the handling path so if we post I created a students list and we can post students to a list so we put a post a couple of names and then we can retrieve those names with a get message this is all it does and creating the daca for sodium let me scroll back on the table of contents okay so on the docker file what we got we are using a Python image for the application but so did it so the flask part is going to be based on a Python image we are copying the requirement we are installing the requirements here they're copying our app we define the environment variable point to the to F dot pi and then we the comment will be to run our application on all network interfaces with flask run that's all and really we don't we are not going to go into details of this code we are going to learn about docker compose so this is what it does I think it's hopefully simple enough to understand and then let's see how we put the put the campos file together so this is the compost file for the same example we're going to have two services one services are is our application which I call app and the other services our Redis service which is very simple it's based on the official image and that's it and as you can see we are describing this under the sir section and I was assuring the entire reference so that you know how this other compost Valley structured but let's start step-by-step on the example and here beyond the services we already had also have another section called the version this is the version of the compost file format the currently this version is 3.7 and I'm using three here as a one-digit main major version for this file so under my app I have a build section because we are going to build a custom image that is described in the docker file so I'm saying that the the bit context is the current directory which means the docker compose will look for the the docker file in the current directory and use device in the current directory for the build and the image will be the resulting image from the build will be cold this one here and this is yeah my docker username plus the name of the image and then I'm specifying what environment variable I'm saying I'm in development and I'm mapping some ports port 5000 to port 5000 on the host machine so this is basically that's all so let's see we can bear this ok so let's move away from our WordPress example and go to the flask and read this example and say dr. Campos beard dr. Campos has a sub command called beard so I can build my stack with docker compose build by default is going to use the cache here so I go to the build this before so you see it's using cash life if I go nope no cash then I can bear the same thing without the cache as well so now that our application is built I hope it's gonna finish it in a second and yeah ok so now you can go darker compose after - day and that means that we are starting up this application in the background and if you look at this this line here what you can see the docker compose has created a default Network for this application if you remember we have not specified and in works here so we are not creating a custom Network at least not yet but dr. Campos will by default create this network for us and it will start up a container for the application and another container for the the datastore so in order to test this so let's let's add some students I have a curl prepared for this so I'm adding a student by the name Bruno to the local host and this is the result that I gathered it was added so let's then curl local host and see and we see that Bruno is included in our datastore so this means that our application is connected to the to the Redis datastore and let's understand how this is done because if you see here we have not specified anything to connect the two right so there is no connection between these the connection is defined basically here the network that was created if I go like darker sorry network list this is the list of my networks and you see this is the flask that is default network and if I do a darker network inspect and this network then you see that the containers that were created are connected to this default network and this network has a very interesting feature the the containers that are connected to this network can refer to each other by name so that means that I can use the service name from the compost pile Redis as a host name to talk to the container on this default network so when you see the our ab dot pi we have called our host Redis and we have done that on purpose because this is the name of the other service in the compost file so if I change this like for my release in the service like this here then I will have to come back to my app on par at the spy and add my Radice as the first name okay we are not going to do that but this is how this works so important point is that you can refer to the container by the name of the service in here and similarly in our WordPress example I have called this service my sequel because the database host name by default in the WordPress image is called my sequel yeah I know that because I dug into the the WordPress official image and I know that this is called my sequel by default in WordPress and then that's why I call this service my sequel ok so now that we are aware of this very important feature let's see how we have to have we can build a compost file so when you are building the compost file is one very important reference material here and that is the compost by reference and this is the official doctor documentation by the way so what you see here is the versions of the compost files so you can check all the versions and they don't add a quarantine compatibility with every version of the of the compost file and most of the time it is enough to to specify the major version that like we have done here we are saying is version 3 but for some features you have to specify the double digit because there are new features and maybe they are missing from here here or or 3 in general then you have to do this like that so the structure of this document is very simple its structured at the same way that the the compost valley structure so the top-level keywords ours are here displayed on the top level on the right you see there is a table of contents here so this is the service configuration this describes how you can define services and if you scroll down you will see that there is a dedicated section for volume configuration network configuration and Co you can specify configs which are config files that you can feed to your containers and you can specify secrets but secrets work only in swarm mode so they are not pretty boy for for dr. Campos and now we have come to an important point then this this documentation here applies to both dr. Campos and Dockers forum I already told you that you can use the compost file with docker compose and also be Dockers forum and this epic this documentation includes all the options for both solutions but not everything is compatible with both so for example if you look at the in the service section you have built and if you look at the build you can see that in our case we are building our application here for example we have a build here and the docker compose we were able to build it right but Dockers form does not support the build section so Dockers Dockers warm very completely ignore it your stack will not be built with with Dockers warm and this distinction is always displayed on the documentation so when you look at the documentation well you usually want to see of course you want to see how the stuff works that's okay but you are looking you should be looking for these kind of nodes so this option is ignored when deploying a stack within is for mode and yeah that's basically the message so with every single point if you see such a node then you will be able to find out if it's compatible with Campos or if it's compatible with swarm and similarly I can show you something that works the other way around like deploy deploy only works in swarm mode and I think this is the node here and only works in small more than will be ignored by docker compose using this documentation is a straightforward process right so let's say you want to do something on the build and we will now let's be able change our build section now so you want to do something on the build of one of your services you come to the beard you read this part and then you can see you know you see what are the available option stuff like you can you can specify dedicated context you can specify a custom darker fine name you can spa you can specify build arguments for the beard and we will we will change our solution to you with these three right now and another interesting option is that you can specify a target so if you have a multi-stage build you can specify which target in the multi stage beard you wanna build with your comp or spy okay so going back let's go back to our little example and say that that we are going to use a build argument and we are going to build this greedy solution like that so then we're gonna we're gonna need to use multiple lines so I will say built and the context is the current directory as you are seen before I can also do like dr5 is a default name but anyway I can specify a darker spy here and then I go I can go arcs and for the arguments what I want to pass is a build argument to the dacra Phi I wanna I'm gonna pass the Python version as the build argument into the docker file so I will create a new argument could fight and version and I make this equal to the Python version from the docker file and I need to change the docker file now so the sense that I need to use this argument here and I need to put the value of this argument again in here so why is this the interesting or important this is important because driving your your bill to be the arguments and variables is always good because you are making your your solution more flexible and more more generic so you can switch between environments you can try out different things and you can put all your configuration into a single file or a single point and then you've done it immediately you know what's going on you don't need to you know look at the Python version in the docker file look at the flask version or sorry in the Redis version in the in the compost pile because then we gonna be kind of extract everything all of these and make them environment variables in in the next step but right now for the first step we are just going to change this for a beer argument so let's try and build this you just go dr. Campos beards and we're gonna really be able to build this and it's working off from cash but you can see that it's using the argument and the argument goes through and there's no change so we have rebuilt it and everything works fine so now that we have rebuilt it let's see a few things that see these people still working so yes our stack is still up and running and you can use commands that are familiar from from the from the darker command set or docker container commands so for example you can do docker compose PS to look at the the running services and the containers in your in your stack or you can do like dr. compose and talk that will list the the processes for for all the services in your architecture and if you want to see like all the logs that are currently flowing and you can follow them so you can follow the logs with docker compose logs - f and these are very similar comments but the important thing is that this this comment will list the the logs for both services and what you can do as well then you can list the loads only for one service like if I go app if I provide the service name here then I'm gonna see only the log messages for the for the app service not both services is that a few commands that I wanted to show you how to manage that and there are of course other commands that were to mention docker compose stop with stop or containers but that means it is not going to remove them so if IPS then they are still around but they are not running and then I can do a start and then it's gonna be gonna be started up again and now they are running or I can very simply do a restart even and then they are gonna be restarted and if I look at the docker compose subcommands I think yeah kill is another one that I use to kill the the service learning logs we have mentioned and yeah I think these are most of the time this and these ideas are the ones that I use most of the time yeah creating the create services yeah you can remove stock containers with with our am I don't really use that too much and we're gonna talk about the rest like pull and push we're gonna talk about these in a minute but I think for managing your application up and down are of course essential and and the commands that we have just seen right now and then now we move on to execute and run one of commands so exact is a very interesting proposition here so they when you work with docker you usually use like something like docker container exec or dr. exact to execute commands on a running container so what you can do here you can do dr. Campos exact and then you go you take the service name you like for example I've take the Redis service and then I do like various CLI and then I go arrange students and then I go 0-1 so with this mod of command I can I can execute a command line command against the running Redis container and then I get the the list of the the students back from the Redis container immediately or but what else I can do I can do like go like add to go to my application and then I can start up a shell and I'm only in interactive mode and then I can list William or this is the application that we created so if you wanna run something in a running container then you can do like this you can do docker compose exact with the service name and then you can do an interactive shell or you can run comments just like this so let's leave this shell and let's do something else docker compose compose run is another thing that you can do docker compose run is different from docker compose exact because exact is is run in the running container but run will start up a new container for you so if you do that this is you can use this if you want if you don't want to mess with the running container where you wanna try something in another container so if I can look like docker compose run and yeah app and let's say I'm listing out everything that is in there then this is what happens and the important point is here though that if I run this so what I can do okay let's go let's do this differently app and let's start up a shell so I started up a shell and then I go darker compose yes and then now you see that this is the second run so this is the one that was started by docker compose up and this this one here was started by dr. Campos run and the big difference is that I'm running a shell here you can see the difference is that the port mapping is not applied so when you do dr. Campos run the port mapping will not be applied because I'm already running a container from the campos file and that has already the port mapping active so it's mapped to port 5000 and if I wanna you know if this would be started up automatically with the port mapping then there would be a port conflict so that girl will start this up automatically without the port mapping but if this is not running you can you can specify port mapping to this even on the command line okay so these are both important use cases or the exact or running one of commands with run I use them quite often so now we have come to another point the concept of desired State and this is a very important point to understand and what you see here in the compost file is basically your applications desired State and so think of this as is this is what I want right so I describe that this this is a port mapping that I want this is the stuff that I want and then your your application is running and your application has some states let's call that the actual state over application and okay let's let me check if SP s yeah okay so there are only only two containers right now good so so if I change this like I change the port mapping to 80 then if I go back here and say docker compose up - D so what docker compose will do automatically this built-in functionality that if we look at the actual states of your application if we look at the desired state in the compost file and if the two are different it will apply the Delta okay so if I run this command right now look at this it said that we have changed the application the port mapping in the compost file and this guy just recreated the the container that is related to the application so it didn't recreate anything else it just recreated the application part did that compute that container nothing else so if I just do a curl localhost now we are on port 80 and we get the student list from port 80 with one here only on it in the terminal so this means that compose file is the desired state whatever you change in the compost pile and you do another docker compose up you don't need to do like you don't need to remove containers you don't need to do all of this you just do another computer co-composer and your entire application will be set up a line and change updated accordingly with the data okay so my database was not recreated it was not removed the data is still there just the application was recreated and moved to another port okay and so we okay desire state we have discussed scaling haha okay so let's do the scaling path docker compose can scale your services so that means that you can actually use docker compose to start up more than one containers for a service so that I can you can do like docker compose up and then you can do like Cal and kind of app equals three then your application would be scared up to three replicas it will not work because there is gonna be a port conflict yeah okay because I'm mapping port 5000 to port 5000 then and I'm receiving port port topics here but the message here is that if you wanna run some application that has a couple of worker containers that are not mapping to a specific port and you use another container that can distribute work across these workers then you can even run that with docker compose with scat services so this is an option that you have and this is available to you all the time ok so now we have this here and if I look at this correctly we have two more points yeah a couple of more points before we before we conclude so let's go to the volumes and the networks so let's how we can define volumes and networks so so so far we have basically defined two services we have change the build to understand how this works we have seen a couple of we have seen a couple of command line options to manage multi container applications and now what we're going to do we're going to add a custom Network so you just come here and on the on the topmost level you add another keyword code networks and you say ok the network code my net so simple and then I attach these guys networks and I say my net and also this guy here networks and - so I created the network I have attached both of these services to that network so if I go a docker compose up HD again then you will see that it has created the network my net and it has recreated the containers so you like darker Network at least then you see that I have a new network code minor and on the default network my containers are not not anymore connected because I can do like darker network through and it's going to remove the deleted they not to use networks and you can see that the default network was deleted so my stuff is using the the net British and I have just defined ok in order to define volumes it happens the same way ok networks is of course a much broader topic than this and you can deep dive into that we are not gonna do that today but if you look here you can see that on this section you can see how you can you can specify all the different options for network so you can you can specify your own subnets you can specify labels you can specify external networks which means that if you are not defining your network here in the compost pile but you have created your network outside of the compost file then you can use an external network as well and connect to that so there are a lot of options here but I don't want to make this video longer going into the details let's say that for the for getting started this let's stay on this level and maybe otherwise and you do another video later but yeah let's move on to volumes now so same way there's a top-level keyword called volumes and volumes you can say that ok I say my data is a volume that I'll be used for this Redis container the Redis container has a volume or a difference we do doctor volume list then you see that these these volumes here are connected these are visible created by the Redis container so I'm going to change that my data and I'm going to say volumes and then say my data and slash data this is the this is the volume that is created by the it is creating the latest image so in order to apply this I need to destroy everything remove it and then I need to bring it up again and you see now it has created the volume it has created the network and the container so if I do a lock volume while you're sorry list then you see that my rat is date of oil is also here and these these guys are not used anymore by will not remove them for now so if you know if you want to use volumes in your application services then you can create them define the name volumes here and you can attach to services with the video volumes keyword and this is important because because the same when the name volume can be reattached so for example this guy here that word press date and the Mario DB data if you remove your stack the the volumes will stay around so if you destroy Mario DB in the in your WordPress stack and recreate your WordPress tag is going to he's gonna be brought up on top of the same volume so the data that you have in your Mario DB instance will be persisted it will be still around so using name volumes that's why it's important to use name volumes so what you can do if you want to run the same stack on another machine you can do you can do docker compose and push and if you I can run this it will take a while maybe have a speed up the video so if I put this it will go through each and every service and and if a service has a custom image it will push it to your central registry right now I'm pushing to the docker hub so I'm pushing this image right now and yeah it will take a while but let's let's prepare for the run anyway so then if you go online and I'm going to use play with docker I don't know if you know this service this service is just a great playground to get start with the darker so I'm adding a new instance and it's already here and let's see if the push ok so the so everything was pushed right now so if I just go back here and then so once you push your images to your cloud registry and like the docker hub then you can go to a cloud server and pull the images and start up your entire application using the campos file so this requires that you somehow make sure that your compost file is on the remote server so if you are managing your own infrastructure you need to set up some means to manage your configuration and way that your doc the docker compose file will somehow be copied to that remote server or you can use an SSH tunnel as well you can use SCP or what you can do what I'm doing I know the manual mode that you drag and drop your compost pile and my compost file is in here so sorry so docker compose Miami is on this machine right now so if I go dr. Campos pool then it will pull all the images that are required by this application so you see this is the custom image that we have and nice it's pulling the Redis image as well so if I go like docker compose for docker compose off dash D then our application is up and running so here this is the server name so if I let's add something here okay so let's put Bruno up in the clouds and if I'm refreshing this then Bruno is there okay let's add another guy because why not so that if you had already deployed to the crab cloud that's let's play around for a while okay so this means that you can use darker compost push to push your images to the cloud you can use dr. Campos pool once you have copied your compost file to any machine in the cloud on-premises wherever if you have the darker compost file available you can do like a compost pool and you can do dr. Campos up and your stack will be up and running on a remote machine and yeah actually dr. swarm bursts the same way oh yeah let's focus on dr. Campos now okay so so we have use docker compose push and pool and yeah I think we covered from the command line options I think yeah we have covered everything that I wanted to tell you and and let's go to the variable substitution part so this is gonna be quite simple from now on so let's say that okay I want to show you how this works environment by could n file so you can specify an M file and say XT this is not yet the variable substitution this is the m5 which is another very handy feature that I use quite often so you can specify an M file and instead of specifying your environment variables here in the compost pile you can specify them in something towards and and file and you can give it your whatever name you like and you just very simply use the same format this one here you save it and you are good to go if I go darker campos - d then everything is up to date okay and then let me show you variable substitution so variable substitution is a way that you can use environment variables or in your session on your computer to to be used in the compose file so instead of specifying these versions here you can make a compost by more flexible more generic by using variables and specifying this value somewhere outside so the easiest way that I use is that I create a file called dot n and I'm using this because if if there is a dot M file in the in the directory where you're running the docker compose commands the dot n Phi will be automatically picked up by the docker compose command so so let's change this and remove something like like python version I will move the Python version to the dog and file and then now what I can do I can go like this and say that this is going to be python version and you get the idea right so I can do the same thing with the with Redis version okay okay and then I can use this variable here like this so right now our alpha is more generic you can I usually replace the the darker username as well I usually specify this also outside so but I think you get the idea right so that if I go dagger comp what's up - T again that the same thing is still working it's the same stuff okay so this is about variable substitution and another important point and I think this is the let me check the the table of contents but yeah this is the this is the last point that I would like to highlight the last point is how to use multiple compos files in a single single project so docker compose uses the docker compose by ml as the default filename okay so like this one here so if you add you can add an other five for dr. Campos don't override or Vienna and docker compose override Lima is another default name so what docker will do when you use docker compose commands it will take the docker compose fighter dr. composed of I am alpha as the first file and apply whatever changes you apply in here it will apply on top of the docker compose Miami file so I can for example specify some part of this let's copy and paste some parts okay and let's say that we just keep the data okay so let's say that we are adding port 5000 here and now if I do a docker compose up like and compose up you will see that is recreating the application service oops sorry that's a - day okay and now if we do a docker compose PS we will see that it's not only running on port 80 as described here for but it's also right running on port 5000 so how does that work some of the options will be overridden and some of the options will be extended so typically whatever is in a list format it will be added to your compost why not absolutely overridden okay but what I can do I can specify something like a container name and let's say buy a container and then if I do docker compose up - Dee it will be recreated and then if I do that a compost PS it says my app container so that's gonna be completely overridden and how to use this typically on in simple scenarios in project scenarios you would put your production configuration in the compost by MFI and you put we would put the development configuration into the override so this is the default and this one is for local development or more complex scenarios in more complex scenarios what you do you usually create dedicated files like dr. Campos dodge a PI ml and the tests prod I think you get the idea and you can then get a nice structure because they can override each other and then you can stack them up and arrive to the to the final state through a stack of compost files you don't need to make this too complicated because after a while it's gotta be a bit overwhelming let's see how you can pick a single compost file so let's say you don't wanna run at the the word add file you just want to run the docker kentucker kapoor's Vimal file so the production version then what you can do you can go like docker compose up and here sorry docker compose - F and then you go - for compost lime add up - T then you're specifying at the exact file and it's repainting the container and now you see that it has the different name now it doesn't have the name that I specified it has the default name because we did not apply the over and then you can use this command format to stack dr. Campos files on top of each other so override yml and then both of them will be applied and then you see that the container name has changed already and you can add more so if I can I can go like docker compose dev dot Vienna and so on right well this is everything I wanted to tell you about docker compose today so I hope you enjoyed it I found it useful you can find the right of the link to the blog port just under this video and yeah check it out you can refer back to it anytime you want and if you like the video please subscribe cheese good
Info
Channel: takacsmark
Views: 73,783
Rating: 4.9483395 out of 5
Keywords: docker, Docker compose, docker compose tutorial, docker tutorial, devops, contaienrs, development tutorials, software development, tutorials
Id: 4EqysCR3mjo
Channel Id: undefined
Length: 50min 13sec (3013 seconds)
Published: Wed Sep 26 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.