Manually Deploy Docker Image to Google Cloud Run | Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey folks today I'm going to show you how you can manually deploy a Docker image to Google Cloud run this isn't something that you would do very frequently but I've done it a few times in the past where I didn't want to deal with setting up Cloud build and that whole process I just wanted to get an image up there really quick and test it so I figured I'd do a quick how-to video on this so let's jump in and get started first thing I'll do is I'll jump into the documentation from Google on how to do this and so this is for pushing and pulling images to container registry first thing you have to do is make sure that container registry is enabled in your project and then second is configuring Docker and installing Docker I'm going to assume that you already have Docker installed and configured the easiest way to check to see if container registry is enabled is to just go to container registry so here's a project that I have I'm going to search for container registry and go to that if it isn't already enabled for you then there would be a little page here that says it's not enabled you just click the enable button and then you're all set just cool down a little bit you'll see that there's instructions on how to configure permissions the first thing you need to make sure you have is the storage admin role and again you can check that by going into Google Cloud console go into IIM finding your user in here and making sure that you have storage admin in this project I'm the owner so I have basically full permissions on everything so this is already set up for me and the second thing you have to do is you have to tag your in image and then push your image to the registry in my example I want to deploy this.net API to Cloud run this is a Docker file that I have for this I'm not going to go through a lot of this because I'm assuming that if you're doing this is you're going to be doing it for any type of Docker file not just for net and the first thing you need to do is you need to build your image so the command for this is Docker build I'll give it a tag of manual test and then I'll say run it from the current working directory and one thing I want to point out which doesn't apply to everybody but if you're using a Mac and you have an M1 chip or an M2 any of the arm chips if you build this it's going to build it assuming that that image will be used on an arm processor and that's not the case Google Cloud run they're not running on arm so you have to tell it what platform to build this on and so if you're in a situation you have to add one more small thing to the stalker build command instead of Docker build you're going to use Docker build X build give it the tag name and then you specify the platform so dash dash platform form and then whatever platform you want to compile to all right so this is my command I'm going to go ahead and run this and I'll put a link down below to the document page for how to do multi-platform builds for Docker alright so my build is complete the next thing we have to do is we have to tag the image so I'll go back to the documents from Google and what you have to do is you have to tag whatever your image name is with the location that you're going to push it to in Google Cloud so in your case this would be Docker tag whatever image name you chose and then gcr.io slash whatever your project name is and then a name that you want to use probably the same name as your tag and this project name that's right here this comes from your Google Cloud project and there's a few ways you can get that project name from Google Cloud a lot of times it's in the URL it's up here at the top if not if you go to the navigation menu and then Cloud overview you want to use this project ID that's right here in the docs I'm going to go ahead and copy this I'm going to go into writer I'm going to paste that in I'm going to change the name my image was manual test my project ID is sbu to playground and then this tag is also manual test so go ahead and run that so that has now tagged that image with that Google Cloud registry address and then back in the docs the last step is you push it so Docker push and then you give it the name that you just tagged it as so in my case Docker push and I'm just going to copy this so I don't screw it up and then enter okay so I did push up now if you go back into Google Cloud if you go into container registry you should see under images you now have a new folder with whatever name you used mine was manual tests and in there you can see there's your image and now that you have this image in container registry deploy into Cloud run is super easy if you go into Cloud run you can create a new service and from this create service page what you want to do is you want to select that container as the starting container for your service so if you click select and you switch over to container registry you can see I have this folder for manual test and right there is that image so I'm going to go ahead and select that and everything from here on out is the exact same as how you would normally set up your Cloud run instance so I'm just going to go through this pretty quick I'm going to leave everything as the very Basics and then go ahead and click create and that should go ahead and deploy this for you and there now you can see my deployment is done I can click this URL to go look at it I need to go to the Swagger page on mine and there you go now it's running so that is how you can do a manual push and deployment of a cloud run container I hope you guys found this useful if you have any questions let me know in the comments down below and I'll put links to all these documents that I use in the description down below thanks for watching and I'll catch you later
Info
Channel: ScriptBytes
Views: 14,996
Rating: undefined out of 5
Keywords:
Id: 7CvD6oHmYxU
Channel Id: undefined
Length: 4min 56sec (296 seconds)
Published: Wed Apr 12 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.