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

Permission denied mounting a volume via docker run in a NON existing folder in the host #19934

Open
1 task done
dancer1325 opened this issue May 1, 2024 · 1 comment
Open
1 task done
Assignees
Labels
area/engine Issue affects Docker engine/daemon area/storage Relates to storage, volumes

Comments

@dancer1325
Copy link

Is this a docs issue?

  • My issue is about the documentation content or website

Type of issue

Information is incorrect

Description

In the documentation is indicated

docker run -v /doesnt/exist:/foo -w /foo -i -t ubuntu bash

When the host directory of a bind-mounted volume doesn't exist, Docker automatically creates this directory on the host for you. In the example above, Docker creates the /doesnt/exist folder before starting your container.

I get an error

docker: Error response from daemon: error while creating mount source path 'XXX/doesnt/exist': chown 'XXX/doesnt/exist: permission denied.
ERRO[0000] error waiting for container:

It's truth that

  • folder is created -- Example: run ls to check --
  • container has run -- docker ps --all --

👁️ but the command itself passed -- docker run ... bash -- has failed 👁️

Notes:

  • Stack
    • docker client
      • 24.0.2-rd
      • API: 1.42
    • docker server engine
      • 23.0.6
      • API: 1.42
    • OS: macOS Sonoma v14.3, intel

Location

https://docs.docker.com/reference/cli/docker/container/run/#volume

Suggestion

  • Is there some way to give the permissions to that folder automatically created by Docker to avoid getting the error?
    • If you run the same command again, it works ... 🤔
  • If there is NO way to get the command succeed -> I would specify in this section of the documentation, because it can confuse to the reader of the documentation, such as

    When the host directory of a bind-mounted volume doesn't exist, Docker automatically creates this directory on the host for you. In the example above, Docker creates the /doesnt/exist folder before starting your container, although in the output of the command you get an error

@dancer1325 dancer1325 added the status/triage Needs triage label May 1, 2024
@dancer1325
Copy link
Author

Maybe @dvdksn ?

@dvdksn dvdksn self-assigned this May 14, 2024
@dvdksn dvdksn added area/engine Issue affects Docker engine/daemon area/storage Relates to storage, volumes and removed status/triage Needs triage labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/engine Issue affects Docker engine/daemon area/storage Relates to storage, volumes
Projects
None yet
Development

No branches or pull requests

2 participants