Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osxfs:cached does not work with named volumes #1899

Closed
lmakarov opened this issue Jul 24, 2017 · 12 comments
Closed

osxfs:cached does not work with named volumes #1899

lmakarov opened this issue Jul 24, 2017 · 12 comments

Comments

@lmakarov
Copy link

Expected behavior

Cached flag should apply when set for a named (bind mounted) volume.

Actual behavior

When using named volumes, the cached flag does not apply.

Information

Diagnostic ID: 6CF6F893-8C12-4325-9733-0847F3114B13

Docker for Mac: version: 17.06.0-ce-mac19 (4cdec4294a50b2233146b09469b49937dabdebdd)
macOS: version 10.12.5 (build: 16F73)
logs: /tmp/6CF6F893-8C12-4325-9733-0847F3114B13/20170724-145905.tar.gz
[OK]     db.git
[OK]     vmnetd
[OK]     dns
[OK]     driver.amd64-linux
[OK]     virtualization VT-X
[OK]     app
[OK]     moby
[OK]     system
[OK]     moby-syslog
[OK]     db
[OK]     env
[OK]     virtualization kern.hv_support
[OK]     slirp
[OK]     osxfs
[OK]     moby-console
[OK]     logs
[OK]     docker-cli
[OK]     menubar
[OK]     disk

Steps to reproduce the behavior

This does not work:

$ docker volume create --name project_root -o type=none -o device=$(pwd) -o o=bind
$ docker run -d --name cached-test -v project_root:/project-root:rw,cached alpine top -b
$ /Applications/Docker.app/Contents/MacOS/com.docker.osxfs state | grep $(basename $(pwd))

This works:

$ docker run -d --name cached-test -v $(pwd):/project-root:rw,cached alpine top -b
$ /Applications/Docker.app/Contents/MacOS/com.docker.osxfs state | grep $(basename $(pwd))

Related to #1592. CC @dsheets

@dsheets
Copy link
Contributor

dsheets commented Jul 25, 2017

@lmakarov thanks for the report. inotify event delivery also does not occur with local docker volumes from bind mounts. To fix this, we will require moby/moby#33375.

lmakarov added a commit to docksal/docksal that referenced this issue Nov 21, 2017
- This will automatically enabled osxfs:cached mode for the project root volume in cli
- The volume has to be defined using the host path. The cached flag cannot yet be used with named volumes. See docker/for-mac#1899
- Docker Compose update in necessary due to a bug older versions have with merging same volume definitions from multiple yml files
achekulaev pushed a commit to docksal/docksal that referenced this issue Nov 27, 2017
* Enable osxfs:cached automatically on Docker for Mac

- This will automatically enabled osxfs:cached mode for the project root volume in cli
- The volume has to be defined using the host path. The cached flag cannot yet be used with named volumes. See docker/for-mac#1899
- Docker Compose update in necessary due to a bug older versions have with merging same volume definitions from multiple yml files
@docker-robott
Copy link
Collaborator

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30d of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle stale

@lmakarov
Copy link
Author

@dsheets the upstream PR you referenced (moby/moby#33375) was closed (not merged) yesterday. Does that mean there will be no solution for this issue in the near future?

@djs55 djs55 self-assigned this Mar 28, 2018
@djs55
Copy link
Contributor

djs55 commented Mar 28, 2018

@lmakarov sorry for the delay and thanks for your patience. I have a candidate fix for this issue which is being tested internally. I'll let you know how it goes.

@achekulaev
Copy link

I wonder if the fix is getting into the next Docker for Mac release?

@djs55
Copy link
Contributor

djs55 commented Jul 5, 2018

@achekulaev could you try the latest edge release? https://docs.docker.com/docker-for-mac/edge-release-notes/ -- it should be fixed there and the same fix will be released on the stable branch soon.

@lmakarov
Copy link
Author

lmakarov commented Aug 1, 2018

I can confirm this now works as expected. Thanks!
Checked with Docker for Mac 18.06.0-ce-mac70 (26399).

@lmakarov
Copy link
Author

@djs55 looks like this is not fully done.

We are now getting the following error with Docker for Mac 18.06.0 when a container with a named volume and the cached flag cannot be recreated (e.g. any docker-compose configuration change). Here's the error:

Recreating drupal8_cli_1 ... error

ERROR: for drupal8_cli_1  Cannot start service cli: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/var/lib/docker/volumes/drupal8_project_root/_data\\\" to rootfs \\\"/var/lib/docker/overlay2/6943a3faf71d8343605d386262051716639d48e15a49df27ca42bbed8a377274/merged\\\" at \\\"/var/lib/docker/overlay2/6943a3faf71d8343605d386262051716639d48e15a49df27ca42bbed8a377274/merged/var/www\\\" caused \\\"no such file or directory\\\"\"": unknown

ERROR: for cli  Cannot start service cli: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/var/lib/docker/volumes/drupal8_project_root/_data\\\" to rootfs \\\"/var/lib/docker/overlay2/6943a3faf71d8343605d386262051716639d48e15a49df27ca42bbed8a377274/merged\\\" at \\\"/var/lib/docker/overlay2/6943a3faf71d8343605d386262051716639d48e15a49df27ca42bbed8a377274/merged/var/www\\\" caused \\\"no such file or directory\\\"\"": unknown
ERROR: Encountered errors while bringing up the project.

This only happened when the volume is defined as:

- project_root:/var/www:cached

The following two versions work without issues:

- project_root:/var/www
/host/path/to/project_root:/var/www:rw,cached

@lmakarov lmakarov reopened this Aug 16, 2018
@lmakarov
Copy link
Author

lmakarov commented Jan 4, 2019

/remove-lifecycle stale

@docker-robott
Copy link
Collaborator

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30d of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle stale

@achekulaev
Copy link

/remove-lifecycle stale

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Jun 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants