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

Unable to start container when using bind mounted volumes (mkdir and permissions issues) #161

Open
99linesofcode opened this issue Jan 24, 2024 · 0 comments

Comments

@99linesofcode
Copy link

99linesofcode commented Jan 24, 2024

When using bind mounts, there are a couple of things that go wrong.

Firstly, if the directory doesn't exist it is created by the root user, and permissions are not changed to the user and group id's passed to docker run or docker-compose.yaml. This causes os.mkdirAll to fail when it attempts to create the /books directory. This is slightly odd since it will create all the parent folders on the host machine (owned by root) but then fails to create the last folder due to permission issues?

Secondly, if the folder does exist, an error is thrown: `Error response from daemon: error while creating mount source path '/home/USERNAME/books': mkdir /home/USERNAME/books: file exists. Makes sense, since the directory is already mounted into the container.

The above seems to happen with other containers as well. edit: yup, this is cause by combining docker bind mounts and fuse filesystems. Please ignore the above.

I would expect openbooks to either create the folders with the correct file ownership settings OR leave things alone if the directories are already present.

Example docker-compose.yaml:

services:
  openbooks:
    image: evanbuss/openbooks
    user: 1000:1000
    volumes:
      - $HOME/books:/books/books
    ports:
      - 8080:80
    command: -s irc.irchighway.net:9999 --persist -n <REDACTED> -u <REDACTED>

edit: typo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant