1

Docker Desktop for Mac has recently released a brand new 4.6 version with many new updates. Most notable of these is the introduction of an experimental feature called virtiofs, which significantly improves file sharing performance for macOS users, and also improves the way files are synced between the macOS host and the Docker virtual machine.

According to the official introduction, these improvements have greatly reduced the file operation time by up to 98%.

The reason this feature provides a huge performance boost is that developers using technologies like Symfony or React need to edit the source code located on the macOS host while running the application itself in a Docker container. Using Docker volumes to share source code between the host and containers, changes made to files located on the host system must be synced to the container file system quickly and reliably for developers to optimize productivity and have a good user experience. When considering that modern dependency management can easily bring 10k–100k files into a project (which linearly increases the performance penalty), this can lead to performance degradation as the host and container are kept in sync via volumes and virtiofs' use, alleviates this problem.

Developers using the early preview of Docker Desktop 4.6 observed: 284 MB MySQL import time was reduced from 3 minutes 16 seconds to 18 seconds; while composer install time for large codebases was reduced by 87% from 1 minute 27 seconds, Only 11 seconds left; and an 80% reduction in the time to start a monolithic Typescript application, from 1 minute 30 seconds to 18 seconds.

how to enable virtiofs

Note: virtiofs is only available for users with the following macOS versions

  • macOS 12.2 and above (M1 series processors)
  • macOS 12.3 and above (Intel processor)

Enable virtiofs in Docker Desktop:

virtiofs is now accessible in Docker Desktop for Mac version 4.6 and is available to all users, including Docker individual free users as well as Docker Pro, Team, and Business paid subscriptions.

At present, because virtiofs is still in the experimental stage, there will be some problems in the use process. The official warning is that a known problem is that containers running virtiofs may fail due to permission errors. Users can escalate any issues they find to the Docker Mac filesystem performance thread.

For more details, please see:
https://docs.docker.com/desktop/mac/#experimental-features

https://www.docker.com/blog/speed-boost-achievement-unlocked-on-docker-desktop-4-6-for-mac/


六一
556 声望347 粉丝

SegmentFault 新媒体运营