Snowpark Container Services

Snowflake · Advanced Features

Theory

Snowpark Container Services (SPCS) runs your own container images inside Snowflake. You push an image to an image repository, a Snowflake registry that works with standard tools like the Docker CLI. A compute pool provides the virtual machine nodes, sized with an INSTANCE_FAMILY such as CPU_X64_XS or a GPU family, and scales between MIN_NODES and MAX_NODES. A service is a long-running container app, such as an API or web UI, defined by a YAML specification; Snowflake restarts its containers if they exit. A job service runs to completion, like a model training run.

For example, a custom Python scoring API can run as a service and be called from SQL through a service function, so the data never leaves Snowflake.

Why we use it

Some workloads do not fit SQL or Snowpark: custom runtimes, specialised libraries, GPUs or full web apps. SPCS runs them next to the data with Snowflake's security and roles, instead of a separate Kubernetes cluster and data copies.

When to use it

Use SPCS for custom APIs, ML training or inference on GPUs, and apps that need their own runtime. Use Snowpark UDFs or procedures when Python code alone is enough, since they need no images or pools. Suspend compute pools when idle because nodes bill while running.

How it works

  1. Build a container image locally
  2. Push it to a Snowflake image repository
  3. CREATE COMPUTE POOL with an instance family and node range
  4. Does the workload run forever or finish? Yes: CREATE SERVICE from a specification. No: EXECUTE JOB SERVICE for a finite run.
  5. Snowflake schedules containers on the pool's nodes
  6. Call it through an endpoint or a service function

Example

CREATE IMAGE REPOSITORY app_db.public.images;

CREATE COMPUTE POOL scoring_pool
  MIN_NODES = 1
  MAX_NODES = 2
  INSTANCE_FAMILY = CPU_X64_XS
  AUTO_SUSPEND_SECS = 600;

-- After docker push to the repository URL:
CREATE SERVICE scoring_service
  IN COMPUTE POOL scoring_pool
  FROM @app_db.public.specs
  SPECIFICATION_FILE = 'scoring_spec.yaml';

SHOW SERVICES;
ALTER COMPUTE POOL scoring_pool SUSPEND;

Key points

Snowflake topics

Snowflake Fundamentals

Warehouses & Performance

Staging & SnowSQL

Tables & Data Handling

Cloud Integrations

Storage & Optimization

Security & Governance

Views, Pipelines & Automation

Data Types & SQL Fundamentals

Semi-Structured Data Deep Dive

Advanced Features

Data Sharing & Collaboration

Cost Management & Monitoring

Databases, Schemas & Objects

Performance Deep Dive

Advanced Security & Governance

Stored Procedures & UDFs

Ecosystem & Integrations

SnowPro Certification Prep

T
Tech Town
Log InSign Up Free
Home SQL Python DSA Power BI Snowflake Databricks Spark Gen AI Practice Problems Contest Blog

Mastering Snowflake

The modern data cloud, from architecture to SnowPro certification. Click any topic in the sidebar to open it right here.

{{ sectionCount }}
Sections
{{ topicCount }}
Topics
Free
Forever
Hands-on practice Practice Snowflake SQL Sharpen the SQL you use in Snowflake: 150 query problems in a live editor with instant checking. Start practising →
Section {{ sec.num }}

{{ sec.label }}

Snowflake  /  {{ current.sectionLabel }}  /  {{ current.name }}

{{ current.name }}

Theory

{{ current.def }}

Why we use it

{{ rich.why }}

When to use it

{{ rich.when }}

{{ sec.h }}

{{ sec.body }}

{{ sec.body }}

Diagram

{{ rich.dg.caption }}

{{ tb.title }}
{{ c.v }}
{{ rich.dg.op }}
➜
{{ rich.dg.output.title }}
{{ c.v }}
{{ nd.label }}
{{ nd.sub }}
{{ nd.label }}
{{ nd.sub }}
{{ rich.dg.left.title }}
{{ it }}
{{ rich.dg.right.title }}
{{ it }}
On screen — where to click

{{ rich.ui.title }}

{{ u.text }}
  1. {{ st.n }}{{ st.text }}
{{ rich.ui.title }}
{{ u.text }}
Flowchart — how it works
{{ nd.text }}
{{ nd.text }}
◇ {{ nd.text }}
Yes → {{ nd.yes }}
No → {{ nd.no }}
Syntax
{{ current.syntax }}
Example
{{ current.example }}
Want to run this yourself? Unlike the SQL and Python courses, Snowflake needs a real account — there's no in-browser engine for it. Click Copy above, then paste it into a free Snowflake trial (30 days, no card required) and run it in Snowsight.
Key Points — click to check off as you learn
  • {{ pt.mark }} {{ pt.text }}

Share this topic