Where Do Permissions of ‘/tmp’ Folder Inside a Docker Container Inherit From?

centos7dockerlinux

I have a PHP docker container failed to start saying that 'session_start' don't have permissions on /tmp/xxxx file.

I found that the '/tmp' folder's permission is 'drwxr-xr-t'. When I change it to 'drwxrwxrwt', the container works as normal.

I might have done something wrong to my host system to debug another unrelated problem. But I don't remember what I have done and what could causing the problem above.

So I want to know where does the permissions of '/tmp' folder inside a docker container inherited from?

Thanks in advance. 🙂

Best Answer

You should find the answer in the Dockerfile.

Either the base image has already those wrong perms, or the Dockerfile is doing something bad during image build.

In both cases, you can just fix this problem in the Dockerfile, and rebuild a new image.