Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Binding Volumes On Host Not Working #9

Open
thespecialbeast opened this issue May 30, 2023 · 8 comments
Open

Binding Volumes On Host Not Working #9

thespecialbeast opened this issue May 30, 2023 · 8 comments

Comments

@thespecialbeast
Copy link

I'm not having any success mapping the two volumes (filestore and include) to my host machine. The include folder has all of the expected files within the container, but when you try to map volumes on a host machine, nothing happens to the directories and when the container gets updated, all your files get lost.

@suntorytimed
Copy link
Owner

I haven't looked too deep into the issue with bind volumes yet. I remember that in the past it resulted in a HTTP 500. It could be a permission issue on the folders with the wrong UID/GID mapping. That's why I used named volumes in the example so far. Not sure what is the recommended way of handling UID/GID mappings of bind mounts in the container, but it is something I will have to look into.

@suntorytimed
Copy link
Owner

Maybe this helps to resolve the issue? https://stackoverflow.com/a/56844765

@shufflerror
Copy link

Is there any progress in mapping the UID and GID to the container?

@suntorytimed
Copy link
Owner

@shufflerror afaik there is nothing I can do about this in the general container build. Either the container is rebuilt with your personal UID and GID or you map it in the docker compose file or docker run (see my comment and link to Stackoverflow above)

@shufflerror
Copy link

shufflerror commented Dec 15, 2023

@suntorytimed I meant it would be nice to have the UID and GID defined as ENV VARS, so everybody can set them as needed in their project. It is described in the last line of your link. "(or define UID and GID as environment variables)"

Hope I will find some spare time to figure it out by myself in the next weeks. I'm relative new to Docker and it's the first time I have to modify an image. Little holiday project.

Maybe something like this but with variables instead of arguments https://dev.to/izackv/running-a-docker-container-with-a-custom-non-root-user-syncing-host-and-container-permissions-26mb

Thanks for your answer.

@Rukongai
Copy link

Problem with bind mounts is that the expose the files from your machine to the docker, not the other way around. So you need to have the folder either links to another location in the docker volume, or set it up to propagate the files after the volume has been created.

I've been messing around with this and I think I have a working version on my repo.

I changed the dockerfile to install to /var/www/resourcespace instead of html, then mount the html folder, then the entrypoint script checks to see if config.php is present in the html folder. If not, it copies the contents over from the resourcespace folder - effectively giving you a "initialization"

I'm still messing around with it (i'm not an expert in the slightest) and I still need to manually do some things post install to make it all happy, but it's a start.

@w84no1
Copy link

w84no1 commented Jan 8, 2024

@Rukongai do you have this working. I was thinking about doing the same thing. You seem to be further along than me. I would love it if you shared your work. Thanks!

@Rukongai
Copy link

Rukongai commented Jan 8, 2024

You can try using mine on dockerhub. I see that I was talking about manual steps but I can't remember what they were. I ended up not using resourcespace for my project

version: "2"
services:
  resourcespace:
    image: rukongai/resourcespace:latest
    restart: unless-stopped
    environment:
      - PUID=1000
      - PGID=1000
    depends_on:
      - resourcespace-db
    volumes:
      - /path/to/appdata/resourcespace/www/html:/var/www/html
    networks:
      - backend
      - frontend
  
  resourcespace-db:
    image: lscr.io/linuxserver/mariadb
    container_name: resourcespace-db
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=supersecretpassword
      - TZ=America/Denver
      - MYSQL_DATABASE=resourcespace
      - MYSQL_USER=resourcespace
      - MYSQL_PASSWORD=supersecretpassword
    volumes:
      - resourcespace-db:/config
    restart: unless-stopped
    networks:
      - backend
      - frontend

volumes:
  resourcespace-db:
    driver: local

networks:
  frontend:
  backend:

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

No branches or pull requests

5 participants