Back in October 2021, we announced Salesforce Functions General Availability and showed you how to get started with Functions locally using our developer tools. Today, we are happy to announce a new feature in the Salesforce CLI: containerless local development.

Why containerless for local development?

When we released Functions, one of the pre-requisites was to rely on Docker to start them in a container. Now, Docker is an optional dependency for developing functions — they may now be built and run on the host operating system during development. You can still run them in containers if you want, however. When deploying functions, our remote build system and our runtime all use containers.

To start a function locally, run the following command:

sf run function start

This is an alias to sf run function start local.

For those wishing to continue using Docker for local function development, you can use the following command:

sf run function start container

Notice that containerless is the new default to run functions locally.

Containerless local development is faster

As you can see from the video below, running a function locally (on the left) is much faster than running it in a container (on the right). If the buildpack images aren’t cached, the container execution times will be dramatically higher.

Try it now!

This feature was released on sf@1.10.0, so be sure to get the most recent version of the Salesforce CLI. You can also sign up for a 30-day trial if you want to deploy your Salesforce Functions to a Salesforce org.

About the author

image.png

Julián Duque is a Principal Developer Advocate at Salesforce. Connect with him on Twitter @julian_duque.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS