Open mfoulds opened 2 months ago
Hi @mfoulds!
I think this kind of problem is typically addressed by adding your user to the docker
group so that it can access those docker fileshares as if it was root.
Have you tried something like sudo usermod -aG docker devuser
? (you may also need to do sudo groupadd docker
if it doesn't exist)
Note that this may have security implications. A more modern and possibly more secure solution may be to run the daemon in rootless mode - see this article: https://docs.docker.com/engine/security/rootless/
Either way I'm fairly sure there's nothing django-simple-bulma
could do to get around this for you, as it's just related to the fact that your docker daemon is running as root
and you're executing commands that need access to the inside of those containers from non-root users. 🐴
Thanks @lemonsaurus. I'll try adding the user to the docker group and will definitely check out rootless mode. In the meantime, I found that changing the permission of the specific directory also works:
RUN if [ -d "/usr/local/lib/python3.11/site-packages/django_simple_bulma/css" ]; then \
chown -R ${USER}:1001 /usr/local/lib/python3.11/site-packages/django_simple_bulma/css && \
chmod -R 775 /usr/local/lib/python3.11/site-packages/django_simple_bulma/css; \
fi
Either way you're right, it's not to do with the django-simple-bulma
package. Thanks again!
TLDR;
I get a permission error when running
collectstatic
. I have a workaround, but wondering if there's a more fundamental fix I can apply?Details
I'm running a dockerised django project. I've installed
django-simple-bulma
and added tosettings
as required.If I run
manage.py collectstatic
as root user, then everything works fine. However when running in development mode as a regular user (I don't have root access inside the development container), I get the error below. Same problem when running on the production VPS server:Inside the container:
Workaround
If I change permissions by running the following as
root
, then everything is ok:Question
But I would prefer not do have to do this. Is there a configuration setting in
django-simple-bulma
that I can change, or something else I can do?