[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[],[],null,["# Containerize your code\n\nTo deploy to Cloud Run, you need to provide a *container image*.\nA container image is a packaging format that includes your code, its\npackages, any needed binary dependencies, the operating system to use, and\nanything else needed to run your service.\n\nDockerfile\n----------\n\nA file named [Dockerfile](https://docs.docker.com/engine/reference/builder/) is\ncommonly used to declare how to build the container image. You can find examples\nof Dockerfiles for popular languages in the\n[build and deploy quickstart](/run/docs/quickstarts#build-and-deploy-a-web-service).\n\nDockerfiles very often start from a base image (e.g. `FROM golang:1.11`).\nYou can find base images maintained by OS and language authors on\n[Docker Hub](https://hub.docker.com/).\nCloud Build checks for [cached images](/container-registry/docs/pulling-cached-images)\nbefore pulling from Docker Hub. If you use a third-party build tool, you can\nconfigure your Docker daemon to check for images in the same cache. You can also\nfind base images managed by Google in the\n[Google Cloud Marketplace](https://console.cloud.google.com/marketplace/browse?filter=solution-type:container&filter=category:os).\n| **Note:** As of November 1, 2020, Docker Hub\n| [rate limits](https://www.docker.com/blog/scaling-docker-to-serve-millions-more-developers-network-egress/) apply to unauthenticated or authenticated pull requests on the\n| Docker Free plan. To avoid disruptions and have greater control over your\n| software supply chain, you can migrate your dependencies to [Artifact Registry](/artifact-registry/docs/docker/migrate-external-containers).\n\nIf you bring your own binaries, make sure they are compiled for Linux ABI\nx86_64.\n\nThese resources provide further information on Dockerfiles:\n\n- Learn Dockerfile syntax through the [Dockerfile reference](https://docs.docker.com/engine/reference/builder).\n- Learn how Dockerfiles fit together through the tips in [Best practices for writing Dockerfiles](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/).\n\nBuildpacks\n----------\n\n[Google Cloud's buildpacks](/docs/buildpacks/builders) helps you build source code\nfrom a set of supported languages into container images without the need for a\nDockerfile.\n\nWhat's next\n-----------\n\nAfter you have containerized your code,\n[build a container image](/run/docs/building/containers) then continue iterating\nin [local testing](/run/docs/testing/local)."]]