Running mongodb in a docker container using your windows

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] welcome today we are going to play with docker and we will do a very nice thing we are going to create a mongodb server using our docker container in windows and then we are going to use a mongodb client the mongodb compass to connect in the mongodb server that will be running in our container it will be very easy and we are going to execute just a few steps that are these ones we are going to download a mongodb image from docker hub we are going to create a container based in the image we are going to take a look in the existing container and then we are going to run the container binding that to a port in our external in our own computer external to the own container and then we are going to connect immune with b server using our mode b client so let's go first step we could take a look in the existing image you as you can see here i have docker installed in my computer and here is the version okay so if you use the command docker images you could take a look at the existing images in my computer i don't have any image related to then i can download that but how can i know the mogul db image name we could browse online in docker hub or we could here use the docker search command and here we could use a keyword like or mongodb then take a look in the output you are going to to carry docker hub and give us the existing image names here we have several image names and here is the first one that's the one we are going to use so once we have found here the the image name we could then go on and create the and downloading so to download the image following the steps i have defined before doctor pool the full command is the comment to download a new image and we just inform the image name and now the download is carried out okay probably have to download a few megabytes and then maybe we have to wait a little bit here but it does not take so long it's very fast in comparison when we download the entire to installing the own computer instead of run that in a docker container so here is the most um heavy download about 200 megabytes but we have already doubled more than the half so just wait a few more seconds and we will be able to run our content container based in this image just more 10 megabytes and now extracting the downloaded file next step as soon as this process is completed that's now now it's completed we could then take a look again in our images and as you can see now we have a image available in our computer so we are able to start a container based in this image as you can see here we could create a container using the create command and then the image name the name that's appear here under the repository column so it's not complicated just say here docker create and then the image to be used as basis so and now we are going to create a container it has created it has outputted the id of this container and now we could take a look in the existing containers with docker px with ps it lists just the executing containers so this container was created but it was not executed if you use here docker ps minus a we are going to see all containers i have a lot of containers in my computer and with minus a we can see here that a container with his id for the mongol image is created 22 seconds ago but it's not running right so to run that we have to use the instruction that's here defined we're going to run uh the container based in the mobile image and we are going to when this container runs it has the server listed in the new sports 27 0017 but we are going to redirect that not to the same port in the local computer we are going to appoint another port like this one twenty seven thousand twenty three okay minus g means it's detached it means it's a background process it's not going to print as a a console to interact and here the means b is for binding the parts and here the management name we can give a name to the container that's going to be and created so we are going to do that now executing this block of code so the container name would be for instance let's call that v1 okay and we're going to run in this part i have previous definer now it's going to create a new container and it's it's running the dashes so we're not seeing anything here because it's the passion and it's listening in this part we could take a look now if i execute again darker yes now we have an executing container that's zipped a red for for 12 seconds and it's leasing in the outside part in their own computer part in the force 27.3 so we could now listen at this point using the mom would be client so here we just paste the url that the connection string format would be and make a connection and you see now we are inside a mongodb server that's running in our own container and we could then explore its collections and documents so here it is one step to step tutorial about how to create your own mongodb server in your windows docker hope you have enjoyed this video and see you next time [Music] you
Info
Channel: Talking about Computer Science
Views: 15,115
Rating: undefined out of 5
Keywords: docker, container, mongodb, devops, nosql, programming, data science, computer science
Id: NEPZqSvKx40
Channel Id: undefined
Length: 6min 55sec (415 seconds)
Published: Tue Mar 15 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.