This is the same port you would use when invoking your service on your local
machine. For example, if to test your code you open localhost:3000, then set
the container port to
3000 in Knative serving.
Knative serving defaults to sending requests to 8080.
The value of the port to which requests are sent is always available in the
PORT environment variable. It is a best practice for your code to listen on
the value defined by the PORT environment variable if possible.
Remove reliance on local filesystem for persistent storage
Check your application code for reliance on local filesystems, and replace it
with file storage on Cloud Storage or data storage such as
Firestore or Cloud SQL.
Add a Dockerfile
In order to wrap your service in a container, you should use a Dockerfile to
define the operating environment. Read more about customizing your Dockerfile
on the Developing your service
page.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-05 UTC."],[[["This guide details the preparation of a web service for containerized deployment on Knative serving, excluding data migration processes."],["Identify and configure the specific port your service listens on, aligning it with the port specified for Knative serving, noting that the default is 8080."],["Eliminate any dependencies on local file systems by switching to cloud-based file storage like Cloud Storage, or databases like Firestore or Cloud SQL."],["Incorporate a Dockerfile to encapsulate your service within a container, which defines the operating environment of your service."],["Optimize your service by tuning concurrency settings and ensuring your application's memory limit is sufficient, including space for any temporary file storage."]]],[]]