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

cannot bind files in the /usr/local/bin #3582

Closed
2 tasks done
Ladicle opened this issue Mar 15, 2019 · 5 comments
Closed
2 tasks done

cannot bind files in the /usr/local/bin #3582

Ladicle opened this issue Mar 15, 2019 · 5 comments

Comments

@Ladicle
Copy link

Ladicle commented Mar 15, 2019

  • I have tried with the latest version of my channel (Stable or Edge)
  • I have uploaded Diagnostics
  • Diagnostics ID: 480A9FC0-73DA-48AD-9FFF-61D286A068E1/20190315014239

Expected behavior

Docker command successfully binds files in the /usr/local/bin in the same way Docker on Linux.

$ docker run --rm -v /usr/local/bin/docker-slim-sensor:/tmp/docker-slim-sensor:ro nginx ls /tmp
docker-slim-sensor

Actual behavior

When a docker command mounts with -v option, it shows the File Sharing error.

$ docker run --rm \
          -v /usr/local/bin/docker-slim-sensor:/tmp/docker-slim-sensor:ro \
           nginx /tmp/docker-slim-sensor
docker: Error response from daemon: Mounts denied:
The path /usr/local/bin/docker-slim-sensor
is not shared from OS X and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.
.
ERRO[0000] error waiting for container: context canceled

However, when it mounts with --mount option, it shows no such file or directory.

docker run --rm \
      -it \
      --mount type=bind,source=/usr/local/bin/docker-slim-sensor,target=/tmp/docker-slim-sensor,readonly \
      nginx /tmp/docker-slim-sensor
docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /usr/local/bin/docker-slim-sensor.
See 'docker run --help'.

In fact, the target directory which is bound /usr/local/bin did not any binaries in the source path(it does not occured outside of /usr/local/bin, and no problem on Linux).

$ ls /usr/local/bin/docker-slim-sensor
-rwxr-xr-x 1 aigarash 4362570 Feb  4 01:05 /usr/local/bin/docker-slim-sensor

$ docker run --mount type=bind,source=/usr/local/bin/,destination=/tmp,readonly nginx ls /
tmp
containerd
containerd-shim
ctr
docker
docker-init
docker-proxy
dockerd
runc

Information

  • macOS Version: Mojave 10.14.3

Diagnostic logs

Docker for Mac: Docker Desktop community Version 2.0.0.3 (31259)
Channel: stable
8858db33c8

Steps to reproduce the behavior

  1. To put docker-slim-sensor to /usr/local/bin
  2. To run the following command
docker run --rm \
      -it \
      --name devtest2 \
      --mount type=bind,source=/usr/local/bin,target=/tmp/,readonly \
      nginx:latest /tmp/docker-slim-sensor
@djs55
Copy link
Contributor

djs55 commented Apr 2, 2019

Docker Desktop on Mac has a whitelist of host directories which may be shared with containers. Since /usr/local/bin is not in your whitelist Docker prints the error

The path /usr/local/bin/docker-slim-sensor is not shared from OS X and is not known to Docker.

If you click on the whale menu -> Preferences you should be able to add /usr/local/bin to the whitelist and hopefully the docker run -v will work as expected. See the section on "File Sharing" in the docs.

Let me know if that makes it work as expected or if you're still having problems.

@Ladicle
Copy link
Author

Ladicle commented Apr 3, 2019

image

I set /usr/local/bin to the file sharing path but it's still having problems.

$ docker run --mount type=bind,source=/usr/local/bin/,destination=/tmp,readonly nginx ls /tmp
containerd
containerd-shim
ctr
docker
docker-init
docker-proxy
dockerd
runc

@ramyavijayan
Copy link

I am facing the same issue. what is the resolution to this problem?

@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

@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 Jul 1, 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

4 participants