Merge pull request #10464 from djs55/DESKTOP-2502-filesharing-part1

Improve Desktop filesharing docs (stable 2.2.0.0)
This commit is contained in:
Usha Mandya 2020-03-17 10:49:31 +00:00 committed by GitHub
commit 41b3a10922
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 49 deletions

View File

@ -147,7 +147,11 @@ You can also move the disk image to a different location. If you attempt to move
#### File sharing
Choose the local directories you'd like to share with your containers. File sharing is required for volume mounting if the project lives outside of the `/Users` directory. In that case, share the drive where the Dockerfile and volume are located. Otherwise, you get `file not found` or `cannot start service` errors at runtime`.
Use File sharing to allow local directories on the Mac to be shared with Linux containers.
This is especially useful for
editing source code in an IDE on the host while running and testing the code in a container.
By default the `/Users`, `/Volume`, `/private`, `/tmp` and `/var/folders` directory are shared. If your project is outside this directory then it must be added
to the list. Otherwise you may get `Mounts denied` or `cannot start service` errors at runtime.
File share settings are:
@ -158,7 +162,6 @@ File share settings are:
There are some limitations on the directories that can be shared:
- It is not possible to share a directory that is a subdirectory of an already shared directory.
- The directory must not exist inside of Docker.
For more information, see:

View File

@ -81,18 +81,12 @@ deployed containers, but rather sets permissions to a default value of
For workarounds and to learn more, see
[Permissions errors on data directories for shared volumes](troubleshoot#permissions-errors-on-data-directories-for-shared-volumes).
### Are symlinks supported?
### How do symlinks work on Windows?
Docker Desktop supports symbolic links (symlinks) created within containers.
Symlinks resolve within and across containers. Symlinks created outside of Docker do not work.
Docker Desktop supports 2 kinds of symlink:
To learn more about the reasons for this limitation, see the following discussions:
* GitHub issue:
[Symlinks don't work as expected](https://github.com/docker/for-win/issues/109#issuecomment-251307391){: target="_blank" class="_"}
* Docker Desktop for Windows forums topic:
[Symlinks on shared volumes not supported](https://forums.docker.com/t/symlinks-on-shared-volumes-not-supported/9288){: target="_blank" class="_"}
1. Windows native symlinks: these are visible inside containers as symlinks.
2. Symlinks created inside a container: these are represented as [mfsymlinks](https://wiki.samba.org/index.php/UNIX_Extensions#Minshall.2BFrench_symlinks) i.e. regular Windows files with special metadata. These appear as symlinks inside containers but not as symlinks on the host.
## Certificates

View File

@ -228,25 +228,25 @@ You can also move the disk image to a different location. If you attempt to move
#### File sharing
Choose the local directories you'd like to share with your Linux containers. File sharing is required for mounting volumes in [Linux containers](#switch-between-windows-and-linux-containers),
not for Windows containers. For Linux containers, you need to share the drive
where the Dockerfile and volume are located. Otherwise, you get `file not found` or `cannot start service` errors at runtime. See [Volume mounting requires shared drives for Linux containers](troubleshoot.md#volume-mounting-requires-shared-drives-for-linux-containers).
Use File sharing to allow local drives on Windows to be shared with Linux containers.
This is especially useful for
editing source code in an IDE on the host while running and testing the code in a container.
Note that configuring file sharing is not necessary for Windows containers, only [Linux containers](#switch-between-windows-and-linux-containers).
If a drive is not shared with a Linux container you may get `file not found` or `cannot start service` errors at runtime. See [Volume mounting requires shared drives for Linux containers](troubleshoot.md#volume-mounting-requires-shared-drives-for-linux-containers).
**Apply & Restart** makes the directory available to containers using Docker's bind mount (`-v`) feature.
**Apply & Restart** makes the drives available to containers using Docker's bind mount (`-v`) feature.
> Tips on shared drives, permissions, and volume mounts
>
* If possible, avoid volume mounts from the Windows host, and instead mount on
the Linux VM, or use a [data volume](/engine/tutorials/dockervolumes.md#data-volumes)
(named volume) or [data container](/engine/tutorials/dockervolumes.md#creating-and-mounting-a-data-volume-container). There are a number of issues with using host-mounted volumes and network paths
for database files. See [Volume mounts from host paths use a nobrl option to override database locking](troubleshoot.md#volume-mounts-from-host-paths-use-a-nobrl-option-to-override-database-locking).
* Shared drives are designed to allow application code to be edited on the host while being executed in containers. For non-code items
such as cache directories or databases, the performance will be much better if they are stored in
the Linux VM, using a [data volume](/engine/tutorials/dockervolumes.md#data-volumes)
(named volume) or [data container](/engine/tutorials/dockervolumes.md#creating-and-mounting-a-data-volume-container).
>
* Docker Desktop sets permissions to read/write/execute for users, groups and others [0777 or a+rwx](http://permissions-calculator.org/decode/0777/).
This is not configurable. See [Permissions errors on data directories for shared volumes](troubleshoot.md#permissions-errors-on-data-directories-for-shared-volumes).
>
* You can share local drives with your _containers_ but not with Docker Machine
nodes. See the FAQ, [Can I share local drives and filesystem with my Docker Machine VMs?](faqs.md#can-i-share-local-drives-and-filesystem-with-my-docker-machine-vms).
>
* Windows presents a case-insensitive view of the filesystem to applications while Linux is case-sensitive. On Linux it is possible to create 2 separate files: `test` and `Test`, while on Windows these filenames would actually refer to the same underlying file. This can lead to problems where an app works correctly on a developer Windows machine (where the file contents are shared) but fails when run in Linux in production (where the file contents are distinct). To avoid this, Docker Desktop insists that all shared files are accessed as their original case. Therefore if a file is created called `test`, it must be opened as `test`. Attempts to open `Test` will fail with "No such file or directory". Similarly once a file called `test` is created, attempts to create a second file called `Test` will fail.
#### Shared drives on demand

View File

@ -122,20 +122,6 @@ deployment
requirements?](faqs.md#can-i-change-permissions-on-shared-volumes-for-container-specific-deployment-requirements)
in the FAQs.
#### inotify on shared drives does not work
Currently, `inotify` does not work on Docker Desktop. This becomes evident,
for example, when an application needs to read/write to a container across a
mounted drive. Instead of relying on filesystem inotify, we recommend using
polling features for your framework or programming language.
* **Workaround for nodemon and Node.js** - If you are using
[nodemon](https://github.com/remy/nodemon) with `Node.js`, try the fallback
polling mode described here: [nodemon isn't restarting node
applications](https://github.com/remy/nodemon#application-isnt-restarting).
* **Docker Desktop for Windows issue on GitHub** - See the issue [Inotify on shared drives does not work](https://github.com/docker/for-win/issues/56#issuecomment-242135705).
#### Volume mounting requires shared drives for Linux containers
If you are using mounted volumes and get runtime errors indicating an
@ -148,11 +134,9 @@ containers). Click ![whale menu](images/whale-x.png){: .inline}
and then **Settings** > **Shared Drives** and share the drive that contains the
Dockerfile and volume.
#### Understand symlinks limitations
#### Support for symlinks
Symlinks work within and across containers. However, symlinks created outside of
containers (for example, on the host) do not work. To learn more, see [Are
symlinks supported?](faqs.md#are-symlinks-supported) in the FAQs.
Symlinks work within and across containers. To learn more, see [How do symlinks work on Windows?](faqs.md#how-do-symlinks-work-on-windows) in the FAQs.
#### Avoid unexpected syntax errors, use Unix style line endings for files in containers
@ -425,14 +409,6 @@ under [Settings](index.md#docker-settings).
## Workarounds
### `inotify` currently does not work on Docker Desktop
If you are using `Node.js` with `nodemon`, a temporary workaround is to try the
fallback polling mode described here: [nodemon isn't restarting node
applications](https://github.com/remy/nodemon#application-isnt-restarting). See
also this issue on GitHub [Inotify on shared drives does not
work](https://github.com/docker/for-win/issues/56#issuecomment-242135705).
### Reboot
Restart your PC to stop / discard any vestige of the daemon running from the