Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Puoi personalizzare l'ambiente di runtime del codice utente nelle pipeline Dataflow fornendo un'immagine container personalizzata. I contenitori personalizzati sono supportati per le pipeline che utilizzano Dataflow Runner v2.
Quando Dataflow avvia le VM worker, utilizza le immagini dei container Docker per avviare i processi SDK containerizzati sui worker. Per impostazione predefinita, una
pipeline Apache Beam utilizza un'immagine predefinita.
Tuttavia, puoi fornire un'immagine container personalizzata per il tuo job Dataflow.
Quando specifichi un'immagine container personalizzata, Dataflow avvia i worker che eseguono il pull dell'immagine specificata.
Potresti utilizzare un contenitore personalizzato per i seguenti motivi:
Preinstalla le dipendenze della pipeline per ridurre il tempo di inizio del worker.
Preinstalla le dipendenze della pipeline che non sono disponibili nei repository pubblici.
Preinstalla le dipendenze della pipeline quando l'accesso ai repository pubblici è disattivato. L'accesso potrebbe essere disattivato per motivi di sicurezza.
Esegui il pre-trattamento dei file di grandi dimensioni per ridurre il tempo di inizio dei worker.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eDataflow pipelines using Runner v2 support the use of custom container images to customize the runtime environment of user code.\u003c/p\u003e\n"],["\u003cp\u003eBy default, Dataflow pipelines use prebuilt Apache Beam images, but users can specify their own custom container images for their Dataflow jobs.\u003c/p\u003e\n"],["\u003cp\u003eCustom containers allow users to preinstall pipeline dependencies, including those not in public repositories, and to manage dependencies when access to public repositories is restricted.\u003c/p\u003e\n"],["\u003cp\u003eUsing custom containers also allows you to prestage large files and launch third-party software to customize the execution environment.\u003c/p\u003e\n"],["\u003cp\u003eThe main use cases of custom containers are to reduce worker start time, customize the environment, and to manage dependencies.\u003c/p\u003e\n"]]],[],null,["# Use custom containers in Dataflow\n\nYou can customize the runtime environment of user code in Dataflow\npipelines by supplying a custom container image. Custom containers are\nsupported for pipelines that use Dataflow\n[Runner v2](/dataflow/docs/runner-v2).\n\nWhen Dataflow starts up worker VMs, it uses Docker container\nimages to launch containerized SDK processes on the workers. By default, a\npipeline uses a prebuilt\n[Apache Beam image](https://hub.docker.com/search?q=apache%2Fbeam&type=image).\nHowever, you can provide a custom container image for your Dataflow job.\nWhen you specify a custom container image, Dataflow launches workers\nthat pull the specified image.\n\nYou might use a custom container for the following reasons:\n\n- Preinstall pipeline dependencies to reduce worker start time.\n- Preinstall pipeline dependencies that are not available in public repositories.\n- Preinstall pipeline dependencies when access to public repositories is turned off. Access might be turned off for security reasons.\n- Prestage large files to reduce worker start time.\n- Launch third-party software in the background.\n- Customize the execution environment.\n\nFor more information about custom containers in Apache Beam, see the\n[Apache Beam custom container guide](https://beam.apache.org/documentation/runtime/environments/).\nFor examples of Python pipelines that use custom containers, see\n[Dataflow custom containers](https://github.com/GoogleCloudPlatform/python-docs-samples/tree/main/dataflow/custom-containers).\n\nNext steps\n----------\n\n- [Build custom container images](/dataflow/docs/guides/build-container-image)\n- [Build multi-architecture container images](/dataflow/docs/guides/multi-architecture-container)\n- [Run a Dataflow job in a custom container](/dataflow/docs/guides/run-custom-container)\n- [Troubleshoot custom containers](/dataflow/docs/guides/troubleshoot-custom-container)"]]