サーバーレスコンテナランタイムにデプロイする
Cloud RunまたはApp Runnerでモデルを実行します。
「サーバーレスコンテナランタイムにデプロイする」はCoddyKit上の無料MLOps Academyレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはMLOps Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 MLOps Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Skip the Servers
A serverless container runtime runs your image without you managing any VMs. You hand over a container, and the platform handles the rest. ☁️
Two Popular Choices
Google offers Cloud Run and AWS offers App Runner. Both pull your image from a registry and expose it behind a managed HTTPS URL.
Deploy from an Image
You point the runtime at your pushed image and it creates a service. With Cloud Run, one deploy command turns an image into a live URL.
gcloud run deploy model-api --image registry.example.com/team/model-api:1.0.0Listen on the Right Port
The platform sends traffic to a port it chooses, exposed as the PORT environment variable. Your app must bind to that value, not a hardcoded one.
uvicorn main:app --host 0.0.0.0 --port ${PORT}Bind to All Interfaces
Inside a container, bind the server to 0.0.0.0, not 127.0.0.1. Otherwise the platform cannot route outside traffic into your process.
Stateless Containers Only
Instances start and stop at any time, so anything saved to local disk can vanish. Keep the service stateless and store data externally.
You Pay for What You Serve
Serverless billing is usually per request and per active second. When no one calls your model, idle time can cost almost nothing. 💸
Mind the Cold Start
If an idle service scaled to zero, the next request waits for a container to boot. That delay is a cold start, common with big model files.
Keep a Warm Instance
To dodge cold starts, set a minimum instances floor. The platform keeps that many containers warm and ready to answer instantly.
gcloud run deploy model-api --min-instances 1Watch the Live Logs
The runtime streams your container output to its logs console. Tail them right after a deploy to confirm the model loaded cleanly.
From Image to Live URL
That is the whole loop: push an image, run one deploy, and the platform returns a public URL serving your model over HTTPS.
Quick Check
Let us check why your first request can feel slow.
Recap
You deployed an image to a serverless runtime, bound to PORT on 0.0.0.0, stayed stateless, and tamed cold starts. Your model is live. 🎉
よくある質問
「サーバーレスコンテナランタイムにデプロイする」レッスンは無料ですか?
はい。「サーバーレスコンテナランタイムにデプロイする」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、MLOps Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 MLOps Academyコースには全4レッスンが含まれています。
「サーバーレスコンテナランタイムにデプロイする」で何を学びますか?
Cloud RunまたはApp Runnerでモデルを実行します。 ブラウザで直接実行するハンズオンコードでMLOps Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
MLOps Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのMLOps Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。
「サーバーレスコンテナランタイムにデプロイする」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このMLOps Academyレッスンでコードを書いて実行できますか?
はい。すべてのMLOps Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- イメージをレジストリにプッシュする
- サーバーレスコンテナランタイムにデプロイする
- オートスケーリングと同時実行数を設定する
- クラウドでシークレットと設定を管理する