The [Pulumi Docker Provider](/registry/packages/docker) has been a top Pulumi provider since it launched in 2018. It can be used to provision any of the resources available in Docker, including containers, images, networks, volumes and more.
One of the most heavily used features of this provider is the `docker.Image` resource, which enables Pulumi users to build and (optionally) push a local Docker context (like an application folder) to a registry as part of a Pulumi deployment. Today we are excited to announce a set of improvements to the `docker.Image` resource driven by the feedback we have received from our community. This set of improvements includes:
Our friends Nikhil Benesch and the Materialize team created a Docker image provider that demonstrated better workflows with Docker BuildKit and we’re excited to finally make these improvements part of our official Pulumi Docker Provider.
To improve the efficiency of the Pulumi Docker Provider, we have changed the default behavior to rebuild only on context change. In addition, the `cacheFrom` option now offers the ability to use a registry as the image cache. By leveraging BuildKit and caching improvements, subsequent rebuilds may be up to 50x faster. This functionality and other improvements of the Pulumi Docker Provider we are announcing today are [highly requested from our community](https://github.com/pulumi/pulumi-docker/issues/132).
The enhanced functionality and performance provided by the [Docker BuildKit](https://docs.docker.com/build/buildkit/) can now be fully leveraged in your Pulumi programs. BuildKit is now the default builder version mode. The V1 builder can still be accessed by specifying `Build.BuilderVersion=BuilderV1`. BuildKit comes with functionality to improve your builds’ performance and the reusability of your Dockerfiles. Cross-platform builds are now supported, enabling image building for a target container runtime that is different from the build environment.
We announced [Pulumi YAML and Pulumi Java](https://www.pulumi.com/blog/pulumi-universal-iac/) last year and are excited to have extended support to the Pulumi Docker Provider. This release schematizes all Docker resources, which enables auto-support of all Pulumi languages. In addition, this means the `docker.Image` resource can now participate in the CRUD (create, replace, update, delete) lifecycle.
The 4.0 version of the Pulumi Docker Provider consists of a significant overhaul of the `docker.Image` resource. As a result there are some breaking changes to the behavior of the `docker.Image` resource and supporting types, as well as some minor name changes.
As the `docker.Image` resource does not manage any backend state, updating to the 4.0 version does not require any resource imports or stack updates.
For most use cases, migrating should be as simple as updating the `pulumi-docker` version to 4.0.0 and adjusting the Pulumi program code to reflect updated types.
The Pulumi Docker Provider has everything you need to build, run, and push Docker images for any container registry. Visit the [Pulumi Docker Provider installation and configuration](https://www.pulumi.com/registry/packages/docker/installation-configuration/) page to start building your next image now!