실습 설정 안내 및 요구사항
계정과 진행 상황을 보호하세요. 이 실습을 실행하려면 항상 시크릿 브라우저 창과 실습 사용자 인증 정보를 사용하세요.

Creating Application Containers with Google Cloud Buildpacks [APPRUN]

실습 45분 universal_currency_alt 크레딧 5개 show_chart 입문
info 이 실습에는 학습을 지원하는 AI 도구가 통합되어 있을 수 있습니다.
이 콘텐츠는 아직 휴대기기에 최적화되지 않음
최상의 경험을 위해 데스크톱 컴퓨터에서 이메일로 전송된 링크를 사용하여 방문하세요.

CBL391

Google Cloud Self-Paced Labs

Overview

In this lab, you learn about Google Cloud buildpacks, which allow developers to create containerized applications and deploy them without the need to install Docker locally, or create a Dockerfile. You will then take the same image and learn to deploy it directly on Cloud Run, allowing Cloud Run to do the building for you.

Objectives

In this lab, you learn to:

  • Build a sample application with pack and the Google Cloud Buildpacks builder.
  • Deploy the resulting container image to Cloud Run.
  • Deploy the same image again, this time using Cloud Run (which uses Google Cloud Buildpacks) to perform the -build and package the container image for you.

Setup and requirements

For each lab, you get a new Google Cloud project and set of resources for a fixed time at no cost.

  1. Sign in to Google Skills using an incognito window.

  2. Note the lab's access time (for example, 1:15:00), and make sure you can finish within that time. There is no pause feature. You can restart if needed, but you have to start at the beginning.

  3. When ready, click Start lab.

  4. Note your lab credentials (Username and Password). You will use them to sign in to the Google Cloud Console.

  5. Click Open Google Console.

  6. Click Use another account and copy/paste credentials for this lab into the prompts. If you use other credentials, you'll receive errors or incur charges.

  7. Accept the terms and skip the recovery resource page.

How to start your lab and sign in to the Console

  1. Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is a panel populated with the temporary credentials that you must use for this lab.

    Credentials panel

  2. Copy the username, and then click Open Google Console. The lab spins up resources, and then opens another tab that shows the Choose an account page.

    Note: Open the tabs in separate windows, side-by-side.
  3. On the Choose an account page, click Use Another Account. The Sign in page opens.

    Choose an account dialog box with Use Another Account option highlighted

  4. Paste the username that you copied from the Connection Details panel. Then copy and paste the password.

Note: You must use the credentials from the Connection Details panel. Do not use your Google Skills credentials. If you have your own Google Cloud account, do not use it for this lab (avoids incurring charges).
  1. Click through the subsequent pages:
  • Accept the terms and conditions.
  • Do not add recovery options or two-factor authentication (because this is a temporary account).
  • Do not sign up for free trials.

After a few moments, the Cloud console opens in this tab.

Note: You can view the menu with a list of Google Cloud Products and Services by clicking the Navigation menu at the top-left. Cloud Console Menu

Activate Google Cloud Shell

Google Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud.

Google Cloud Shell provides command-line access to your Google Cloud resources.

  1. In Cloud console, on the top right toolbar, click the Open Cloud Shell button.

    Highlighted Cloud Shell icon

  2. Click Continue.

It takes a few moments to provision and connect to the environment. When you are connected, you are already authenticated, and the project is set to your PROJECT_ID. For example:

Project ID highlighted in the Cloud Shell Terminal

gcloud is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.

  • You can list the active account name with this command:
gcloud auth list

Output:

Credentialed accounts: - @.com (active)

Example output:

Credentialed accounts: - google1623327_student@qwiklabs.net
  • You can list the project ID with this command:
gcloud config list project

Output:

[core] project =

Example output:

[core] project = qwiklabs-gcp-44776a13dea667a6 Note: Full documentation of gcloud is available in the gcloud CLI overview guide .

Reference

Basic Linux Commands

Below you will find a reference list of a few very basic Linux commands which may be included in the instructions or code blocks for this lab.

Command --> Action . Command --> Action
mkdir (make directory) create a new folder . cd (change directory) change location to another folder
ls (list ) list files and folders in the directory . cat (concatenate) read contents of a file without using an editor
apt-get update update package manager library . ping signal to test reachability of a host
mv (move ) moves a file . cp (copy) makes a file copy
pwd (present working directory ) returns your current location . sudo (super user do) gives higher administration privileges

Task 1. Enable the Cloud Run API and configure your Shell environment

  1. From Cloud Shell, enable the Cloud Run API:

    gcloud services enable run.googleapis.com

    If you are asked to authorize the use of your credentials, do so. You should then see a successful message similar to this one:

    Operation "operations/acf.cc11852d-40af-47ad-9d59-477a12847c9e" finished successfully. Note: You can also enable the API using the APIs & Services section of the console.
  2. Set the compute region:

    gcloud config set compute/region {{{project_0.default_region | REGION }}}

Task 2. List the pack CLI commands

The pack CLI has already been installed on your lab account.

  1. To see the list of pack commands available to you, open your cloud shell terminal and type pack. You should see output similar to the example below:

    Output displaying Usage, Available Commands, and Flags for the pack command

  2. Scan the list.

Task 3. Clone the Buildpack sample repository

Google Cloud Buildpack helps developers focus on writing code, not on containerizing it. Buildpack supports the following languages: Java, Node, Go, Python, and .NET (C#). Google provides a Buildpack Repository containing sample code you can use to practice using Buildpack to easily containerize and deploy applications.

To use the provided sample applications in the language of your choice, you will first need to clone the Buildpack repository and then select a sample to build with the pack build command.

Clone the buildpack-samples repository

  • Clone the buildpacks samples repository to your local directory using the command below:

    git clone https://github.com/GoogleCloudPlatform/buildpack-samples.git

Select your sample application

  • Update the pack binary in Cloud Shell:
(curl -sSL "https://github.com/buildpacks/pack/releases/download/v0.39.0/pack-v0.39.0-linux.tgz" | sudo tar -C /usr/local/bin/ --no-same-owner -xzv pack)
  • Copy code from the language of your choice, shown in the list in the table below. Use this code in the cloud shell to build an application container. (You only need to create one container in one of these languages for the purposes of this lab.)
cd buildpack-samples/sample-node pack build --builder=gcr.io/buildpacks/builder sample-node cd buildpack-samples/sample-python pack build --builder=gcr.io/buildpacks/builder sample-python cd buildpack-samples/sample-go pack build --builder=gcr.io/buildpacks/builder sample-go cd buildpack-samples/sample-java-gradle pack build --builder=gcr.io/buildpacks/builder sample-java-gradle cd buildpack-samples/sample-java-mvn pack build --builder=gcr.io/buildpacks/builder sample-java-mvn cd buildpack-samples/sample-dotnet pack build --builder=gcr.io/buildpacks/builder sample-dotnet

Run your new build container in Docker

  1. Run the appropriate section from the command below to bind the sample app created in the previous step to port 8080, so that it can be accessed via the browser.
docker run -it -e PORT=8080 -p 8080:8080 sample-node docker run -it -e PORT=8080 -p 8080:8080 sample-python docker run -it -e PORT=8080 -p 8080:8080 sample-go docker run -it -e PORT=8080 -p 8080:8080 sample-java-gradle docker run -it -e PORT=8080 -p 8080:8080 sample-java-mvn docker run -it -e PORT=8080 -p 8080:8080 sample-dotnet
  1. In the Cloud Shell window, click on the Web preview icon and select Preview on port 8080.

A new browser will open showing the "hello, world" message.

  1. Press CTRL+C to stop the application.

Task 4. Build and run your sample app on Cloud Run

In the tasks above, we have built a container image locally using pack. After this, the next step would generally be pushing the container to Artifact Registry and then deploy to Cloud Run. However, it is also possible to have Cloud Run do all of the building and deployment for you.

  1. Use the one-step gcloud command to deploy your container:

    gcloud beta run deploy --source .
  2. When prompted:

    • Confirm the service name by pressing Enter.
    • Choose region.
    • If asked to allow unauthenticated invocations, type Y and press Enter.

    Wait a few minutes until the deployment is complete. The output should look similar to the below example:

    Done. Service [sample-node] revision [sample-node-00001-woz] has been deployed and is serving 100 percent of traffic. Service URL: https://sample-node-z2caq24usq-uc.a.run.app

Congratulations!

You have completed this lab!

Next steps / Learn more

For more information on building a stateless HTTP container suitable for Cloud Run from code source and pushing it to Container Registry, see:

End your lab

When you have completed your lab, click End Lab. Google Skills removes the resources you’ve used and cleans the account for you.

You will be given an opportunity to rate the lab experience. Select the applicable number of stars, type a comment, and then click Submit.

The number of stars indicates the following:

  • 1 star = Very dissatisfied
  • 2 stars = Dissatisfied
  • 3 stars = Neutral
  • 4 stars = Satisfied
  • 5 stars = Very satisfied

You can close the dialog box if you don't want to provide feedback.

For feedback, suggestions, or corrections, please use the Support tab.

Copyright 2026 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.

시작하기 전에

  1. 실습에서는 정해진 기간 동안 Google Cloud 프로젝트와 리소스를 만듭니다.
  2. 실습에는 시간 제한이 있으며 일시중지 기능이 없습니다. 실습을 종료하면 처음부터 다시 시작해야 합니다.
  3. 화면 왼쪽 상단에서 실습 시작을 클릭하여 시작합니다.

시크릿 브라우징 사용

  1. 실습에 입력한 사용자 이름비밀번호를 복사합니다.
  2. 비공개 모드에서 콘솔 열기를 클릭합니다.

콘솔에 로그인

    실습 사용자 인증 정보를 사용하여
  1. 로그인합니다. 다른 사용자 인증 정보를 사용하면 오류가 발생하거나 요금이 부과될 수 있습니다.
  2. 약관에 동의하고 리소스 복구 페이지를 건너뜁니다.
  3. 실습을 완료했거나 다시 시작하려고 하는 경우가 아니면 실습 종료를 클릭하지 마세요. 이 버튼을 클릭하면 작업 내용이 지워지고 프로젝트가 삭제됩니다.

현재 이 콘텐츠를 이용할 수 없습니다

이용할 수 있게 되면 이메일로 알려드리겠습니다.

감사합니다

이용할 수 있게 되면 이메일로 알려드리겠습니다.

한 번에 실습 1개만 가능

모든 기존 실습을 종료하고 이 실습을 시작할지 확인하세요.

시크릿 브라우징을 사용하여 실습 실행하기

이 실습을 실행하는 가장 좋은 방법은 시크릿 모드 또는 시크릿 브라우저 창을 사용하는 것입니다. 개인 계정과 학생 계정 간의 충돌로 개인 계정에 추가 요금이 발생하는 일을 방지해 줍니다.