Compose: make tmpfs permissions 777 and remove noexec flag

Created on 6 May 2016  路  5Comments  路  Source: docker/compose

using the tmpfs option in the compose file makes the directory not very useful in some scenarios. it gets mounted as:
tmpfs on /src/core/node_modules type tmpfs (rw,nosuid,nodev,noexec,relatime,size=65536k)
which means it:

  • can't be written to if using the user option - it's root:root, mode 755.
  • can't execute stuff from it, cause of the noexec flag

I suggest removing noexec and making it mode 777

Most helpful comment

ok, it's possible to specify the options with:

tmpfs:
  - /tmp:exec,mode=777

All 5 comments

ok, it's possible to specify the options with:

tmpfs:
  - /tmp:exec,mode=777

I've tried mode=777 and mode=1777 but the actual set permissions are still 755. Inspecting the running container reveals, that the option was set on the container with "/run": "exec,mode=1777" correctly, but somehow the permissions weren't set on /tmp.

for me I had to change the permissions on the host filesystem directory I was mounting the tmpfs over

Is docker using the permissions mount options of tmpfs after start a container?
In my tests the permissions only works when creating the container and the underlying directory does not exist.

I think the expected and correct behavior should be that tmpfs should always honor the mount options permissions.

I couldn't get it to respect the mode=777 but what worked in my scenario was setting the user and group mount options:

docker run --tmpfs /app/tmp:uid=1000,gid=1000 ...
Was this page helpful?
0 / 5 - 0 ratings