When specifying mounts in devcontainer.json, we can use volume or bind mounts:
By default, if the src doesn't exist on the host the dev container start fails. In some scenarios it is desirable to create a mount if it exists, but it is preferable to continue without the mount rather than fail to start.
An example is when you wish to mount the .azure folder from the host into the dev container to share login credentials between host and container as a convenience mechanism. In this scenario, it would be nice to make the mount optional, i.e. to strip the mount out of the configuration if the src doesn't exist on the host. In this example, this would be if the user doesn't have the azure CLI installed on the host. If the mount was optional, the dev container would still run and the user would log in inside the dev container.
With this extra property to items in the mounts array to allow bind mounts to be indicated as optional, the above bind mount for the .azure folder would look like:
This could also be supported by the string form:
When specifying mounts in
devcontainer.json, we can usevolumeorbindmounts:By default, if the
srcdoesn't exist on the host the dev container start fails. In some scenarios it is desirable to create a mount if it exists, but it is preferable to continue without the mount rather than fail to start.An example is when you wish to mount the
.azurefolder from the host into the dev container to share login credentials between host and container as a convenience mechanism. In this scenario, it would be nice to make the mount optional, i.e. to strip the mount out of the configuration if thesrcdoesn't exist on the host. In this example, this would be if the user doesn't have the azure CLI installed on the host. If the mount was optional, the dev container would still run and the user would log in inside the dev container.With this extra property to items in the
mountsarray to allowbindmounts to be indicated asoptional, the abovebindmount for the.azurefolder would look like:This could also be supported by the string form: