How To Deploy Docker Image For Free On Google Cloud

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I'll show you how to build and deploy any Docker image to Google Cloud the first thing you want to do is make sure you have a Google Cloud account so go to cloud.google.com and create account there and then the next step would be to install the Google Cloud CLI so you need to follow the steps here to install uh command line interface so after you've finished installing this COI go back to the Google Cloud console so do that to do that click this console button and then from here you want to create a new project so I'll just name your product name whatever and then click create now it's done select the project and then now from here you want to enable three apis on Google Cloud so the first one will be called artifact registry so just search up artifact registry click enable some error just it's fine just click retry if you get this error all right so now it's enabled go back enable uh the next one will be Cloud build such a cloud build enable this one all right this one's done as well and then the final one is uh should be Cloud deploy and then just enable this one all right so now this part is done after you make your Google Cloud account you want to make sure you have billing enabled so to do that click the menu and the click there's this billing tab so just click that and uh so I already have this I already set this up but you need to set it up and so you will need a credit card to do this but it won't charge you um since uh you're gonna hear you see that uh we do get a bunch of free credits to use now the next step will be logging into Google cloud in a terminal so make sure I already have the CLI installed at this point so just do gcloud auth login and it should pull this page and then you have to sign in and then allow and then now you should be able to should now be signed in and now the next step is uh I'm going to set um the current product to the project you just created so for me I already did this but just to do it again to do a gcloud config set project and this project ID is uh from before so if you go back to the uh the dashboard of the project you just made the project ideas right here so just copy this all right and now we should be good to go so my Docker image is just like this is uh I'm just using the create react example here so it's very simple and I guess you see my Docker file is right here very simple very simple so you want to make sure that uh everything works locally first so uh just run these commands blocker build oops Apple Dot and then all right so now I just run it locally just to make sure it works so let's go to localhost 3000 and you see that it's now running on docker and everything works so now we can um build and deploy this on Google Cloud without any issues so to do that go back to the terminal and you need to run this command G cloud create and then um so what we're doing here is creating a folder for uh the docker image so you can just uh you need to name a name for this folder let's call this yeah just name it whatever you want and then we need to add this option Repository format improved Docker and then the location options for me I'll just go with uh us Central One you could you could choose whatever you want and then finally a description option all right so now click enter and it should be creating this folder all right so now it's done create a repository and we can actually go back here and check so just search a part of package three and we see that okay this is a folder that we just made the next I will be building our Docker image and storing in this folder so to do this back to terminal and we run this command gcloud build submit and then you need to pick a region again so we just go with the same one for me U.S Central One and then we need a tag name so this part is important so for the tag name um you want to go back to the artifact registry here and then click into it and then you see here that uh this should be this copy icon to get the full name so we'll just copy this here and then paste it here and then after that you need to add a you want to have a name name for the image so you just add a slash and then name it whatever you want like so I'll just name it this react gcloud example image and then you need a colon and then add this tag one here so this is just giving you giving this a tag you'll see later why we need this so just click enter here and now we should be building our Docker image okay so if you get if you run into this issue we enabled it already enabled the API but it's fine just yes again just to enable it again okay I named it wrong uh spelling error I'll just fix this real quick my bad us Central one here all right now she's gonna go so this would take a couple of minutes all right now it's finally done and now uh we go back to the artifact registry uh the photography this photo we made and just refresh the page you should see our our Docker image so it's now we have uploaded it successfully now the final step is just deploying it so to do this we just run gcloud run deploy and then the image name is uh uh so go back here and click on uh this image you just uploaded and you're good you're able to copy the entire name and you see here that uh the reason we had to add a tag is because we need a text for the docker image so we have we see this take here so just paste here and don't forget the colon tag one and then enter and now it'll ask you for some options so whatever you want to name the service again I guess we need to just enable it here I guess again so yes and uh now we just select a server I went with I went with U.S Central one so I'll be going with that again and here uh yes you just put yes here and now it should be deploying now we see that's done and it has given us a server URL so now the moment of truth copy this and paste it here and there we go we see that we have deployed it to Google Cloud now to just to check to be sure we can search up here Cloud run and here you see that uh this is a service that we just made so there you go uh this is how to deploy a Docker image build and deploy a Docker image to Google Cloud
Info
Channel: KaizneCodes
Views: 7,442
Rating: undefined out of 5
Keywords:
Id: 0FUsQkZyd48
Channel Id: undefined
Length: 12min 45sec (765 seconds)
Published: Sun Apr 16 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.