Permission issues on '/tmp' in many docker containers


Recommended Posts

Hi! 

 

Lately, a bunch of my docker containers started having trouble writing to their /tmp folders. They always mention permission denied. Dockers with this problem include but are not limited to Nextcloud, WordPress, MariaDB, Baikal, ...

I haven't been able to find a fix for this, neither have I been able to identify why this is happening. However, I need this fixed ASAP.

 

I am using unRAID version 9.6.2

 

Thanks!

Edited by maartenweyns
Link to comment
  • 4 weeks later...

Unless you map /tmp to host storage, each container has its own /tmp folder, and that would be inside that container's image within docker.img where it can't be easily affected by anything such as new perms or Unraid command line unless you go to a command line inside the container.

 

Does anybody on this thread have anything they can show such as error messages or screenshots?

Link to comment

Hello,

 

I have the issue too.

After a reboot of Unraid, the /tmp and /var/tmp folders are set with permissions 755 in every docker containers.

To correct this, I have to chmod 777 the folders and the permissions remain set to 777 even after a container restart.

 

I also tried to disable/enable the Docker service via Unraid GUI and the same issue occured. So it seems to come from either the service shutdown or start.

I did this test again but the issue didn't occured. I certainly did it wrong the first time, sorry for that 😅

 

I'm on Unraid 6.9.2 with Docker 20.10.5.

 

As example, I have a container running the image of linuxserver/mariadb, when this container launches, mariadb will log this error 
[ERROR] mariadbd: Can't create/write to file '/var/tmp/ibXXXXXX' (Errcode: 13 "Permission denied")

Edited by MewFortyTwo
Correct after having redone a test
Link to comment
13 hours ago, trurl said:

Unless you map /tmp to host storage, each container has its own /tmp folder, and that would be inside that container's image within docker.img where it can't be easily affected by anything such as new perms or Unraid command line unless you go to a command line inside the container.

 

Does anybody on this thread have anything they can show such as error messages or screenshots?

My container config for `/tmp` is set to `/tmp/nextcloud/`. Nextcloud is the only container I'm having problems with in regards to this (to my knowledge at least), everything else seems to work just fine, and I'm running a lot of containers. Sorry I can't be helpful, I'm not hugely familiar with Unraid's implementation of Docker.

 

Silly question of the day: as this folder is showing up in `/tmp/nextcloud/`, does this mean that it isn't actually within the docker.img itself? And is this thus not a recommended/advisable configuration? :- )

Link to comment
1 hour ago, Hammy Havoc said:

Silly question of the day: as this folder is showing up in `/tmp/nextcloud/`, does this mean that it isn't actually within the docker.img itself? And is this thus not a recommended/advisable configuration? :- )

/tmp on the host is in OS rootfs. OS rootfs is in RAM. The OS is unpacked fresh from the archives on flash at each reboot, and runs completely in RAM. Think of it as firmware.

 

So using /tmp on the host will not survive. Also if you fill up rootfs the OS will misbehave since it won't be able to work with its own files. Only mounted storage persists.

  • Like 1
Link to comment
4 hours ago, MewFortyTwo said:

I also tried to disable/enable the Docker service via Unraid GUI and the same issue occured. So it seems to come from either the service shutdown or start.

 

 

I did this test again but the issue didn't occured. I certainly did it wrong the first time, sorry for that 😅

 

 

4 hours ago, trurl said:

Do you mean you actually went to the command line within each container to see this? (click container icon, select >_ Console) 

 

I did this test on command line within five differents container with differents images and for the five the permissions of /tmp and /var/tmp was reset to 755 after an Unraid full reboot.
There is the list of the image name :

Link to comment
  • 4 weeks later...

As I have the same problem, I "solved" if by creating the dirs on boot time with chmod 777 permissions through the Go file:

 

# -------------------------------------------------
# Correct wrong container path permissions on server reboot
# -------------------------------------------------
mkdir -m 777 -p /tmp/nginx-proxy-manager/var/log
mkdir -m 777 -p /tmp/pihole/var/log/lighttpd

 

It seems the permissions are set different if a container is created or started (and the dirs do not exist).

 

But I'm still testing...

Link to comment
  • 1 month later...
18 minutes ago, mcdax said:

Same goes for me. It's a real pain ...

After each restart I have to change the permissions of /tmp and /var/tmp for ~7 containers.

 

On 12/15/2021 at 2:40 PM, mgutt said:

As I have the same problem, I "solved" if by creating the dirs on boot time with chmod 777 permissions through the Go file:

 

# -------------------------------------------------
# Correct wrong container path permissions on server reboot
# -------------------------------------------------
mkdir -m 777 -p /tmp/nginx-proxy-manager/var/log
mkdir -m 777 -p /tmp/pihole/var/log/lighttpd

 

It seems the permissions are set different if a container is created or started (and the dirs do not exist).

 

But I'm still testing...

 

Link to comment

For that you have to mount the container-tmp directory to your host-tmp directory. 

Sure, it helps, but it sounds like a nasty workaround to me.

 

Same as my solution:
docker container exec sabnzbd chmod 777 /tmp

docker container exec mariadb chmod 777 /tmp

...

 

If I run the same images on my workstation with docker(-compose), I don't have such problems.

Edited by mcdax
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.