sincecutoff.com
← all changes

Docker `--mount` bind mounts accept `bind-create-src`

Introduced 2026-03-05 · score 0.96

HOW TO USE IT

When creating a bind mount whose source directory may not exist, add the `bind-create-src` option to `docker run --mount`. Docker creates the source directory on the daemon host if needed.

docker run --mount type=bind,source=<host-path>,target=<container-path>,bind-create-src <image> [command...]

WHY THIS HELPS

Create a bind mount whose source directory may not exist yet.

BEFORE THIS CHANGE

Without `bind-create-src`, `--mount` returns an error when the source path does not exist on the daemon host.

REQUIREMENTS AND LIMITATIONS

  • Version: 29.3.0
  • type=bind (required): Selects a bind mount.
  • source (or src)=<host-path> (required): Host path to mount; can be absolute or relative.
  • target (or dst, destination)=<container-path> (required): Absolute path where the mount appears in the container.
  • bind-create-src: Creates the source directory on the daemon host if it does not exist.
  • Prerequisite: The source path is on the Docker daemon host. With a remote daemon, this does not create a path on the client machine.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card