Chapter 3. Building Containers
In Chapter 2, I showed you how to deploy my sample container image on Cloud Run. If you want to deploy your code to Cloud Run, you need to build your code into a container image and push it to Artifact Registry to deploy (Figure 3-1). This chapter will show you how to do that.
Artifact Registry is a product on Google Cloud that helps you host and distribute container images and other build artifacts such as npm and Maven packages. You’ll need to create a repository to store the container images you’ll create while working through the book.
I’ll start by explaining container technology from first principles. It will be a great introduction if you’re just getting started with containers; if you’re already an expert, it’s a useful review of what you already know.
With the fundamental concepts covered, I’ll show you various approaches to turn your source code into a container image. I’ll start with Docker, which offers a relatively low-level experience, and show you how to store your local container image in Artifact Registry on Google Cloud.
I will follow up with three alternatives to Docker that require (almost) no configuration. If you’ve ever struggled to create a small, secure image while trying to learn Docker from scratch (I know I have), you will love this last part.
Finally, I’ll demonstrate the various ...
Get Building Serverless Applications with Google Cloud Run now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.