Synchronized file shares (original) (raw)

Subscription: Pro Team Business

Synchronized file shares is an alternative file sharing mechanism that provides fast and flexible host-to-VM file sharing, enhancing bind mount performance through the use of synchronized filesystem caches.

Image of Synchronized file shares pane

Image of Synchronized file shares pane

Synchronized file shares is ideal for developers who:

A Synchronized file share behaves just like a virtual file share, but takes advantage of a high-performance, low-latency code synchronization engine to create a synchronized cache of the host files on an ext4 filesystem within the Docker Desktop VM. If you make filesystem changes on the host or in the VM’s containers, it propagates via bidirectional synchronization.

After creating a file share instance, any container using a bind mount that points to a location on the host filesystem matching the specified synchronized file share location, or a subdirectory within it, utilizes the Synchronized File Shares feature. Bind mounts that don't satisfy this condition are passed to the normal virtual filesystembind-mounting mechanism, for example VirtioFS or gRPC-FUSE.

Note

Synchronized file shares is not used by Kubernetes' hostPath volumes in Docker Desktop.

Important

Synchronized file shares isn't available on WSL or when using Windows containers.

To create a file share instance:

  1. Sign in to Docker Desktop.
  2. In Settings, navigate to the File sharing tab within the Resources section.
  3. In the Synchronized file shares section, select Create share.
  4. Select a host folder to share. The synchronized file share should initialize and be usable.

File shares take a few seconds to initialize as files are copied into the Docker Desktop VM. During this time, the status indicator displays Preparing. There is also a status icon in the footer of the Docker Desktop Dashboard that keeps you updated.

When the status indicator displays Watching for filesystem changes, your files are available to the VM through all the standard bind mount mechanisms, whether that's -v in the command line or specified in your compose.yml file.

Note

When you create a new service, setting thebind mount option consistency to :consistent bypasses Synchronized file shares.

Tip

Docker Compose can automatically create file shares for bind mounts. Ensure you're signed in to Docker with a paid subscription and have enabled both Access experimental features and Manage Synchronized file shares with Compose in Docker Desktop's settings.

The Synchronized file shares section displays all your file share instances and provides useful information about each instance including:

Selecting a file share instance expands the dropdown and exposes this information.

You can use a .syncignore file at the root of each file share, to exclude local files from your file share instance. It supports the same syntax as .dockerignore files and excludes, and/or re-includes, paths from synchronization. .syncignore files are ignored at any location other than the root of the file share.

Some example of things you might want to add to your .syncignore file are:

In general, use your .syncignore file to exclude items that aren't critical to your workflow, especially those that would be slow to sync or use significant storage.