Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmpfs-mode not implemented in Compose file syntax #1285

Closed
t-anjan opened this issue Aug 13, 2018 · 11 comments
Closed

tmpfs-mode not implemented in Compose file syntax #1285

t-anjan opened this issue Aug 13, 2018 · 11 comments

Comments

@t-anjan
Copy link

t-anjan commented Aug 13, 2018

Description

This is very closely related to this issue: #698 and PR: #808 .

Although the above two links talk about tmpfs-mode, only tmpfs-size was included in the Compose file syntax.

Creating this issue here so the maintainers do not lose sight of the tmpfs-mode option.

P.S. - Is there any quick workaround / alternative way of setting the mode for tmpfs in the compose file? Or is it not possible at all? (Compose file version 3.6)

@mterron
Copy link

mterron commented Oct 16, 2018

@t-anjan see #698 comment

@jay-to-the-dee
Copy link

This still appears to be an issue in compose file version 3.7 (unless the documentation just hasn't been updated?)

@fredleger
Copy link

still no fix for that. when most of recommendations are saying to us to never run any container as root this is clearly a NO GO for any container needing a tmpfs.

@serut
Copy link

serut commented Apr 17, 2020

I just found out this issue and started to crumple...
But in fact I succeeded to launch the official nginx image with fake user + read only.
Indeed, you cannot set the uid / gid when setting the tmpfs volume, but in fact the volume is created with the same rights than the existing folder in the container. So I just needed to add this in my Dockerfile :

# Allow non root user to launch nginx
RUN chown root:root /var/cache/nginx \
    && chmod 0777 /var/cache/nginx \
    && chown root:root /run \
    && chmod 0777 /run
version: '3.7'
[...]
  rs-front:
    image: <customimage>
    user: "3050:1050"
    read_only: true
    volumes:
      - type: tmpfs
        target: /var/cache/nginx
      - type: tmpfs
        target: /run
[...]

Of course it should be documented somewhere in the documentation of tmpfs !!!!!!

@fredleger
Copy link

fredleger commented Apr 17, 2020 via email

@serut
Copy link

serut commented Apr 17, 2020

Salut Fred,
No I don't think this is open bar in terms of security, but I agree with you I cannot make wonderfull things as I can't know what is the future user that will run everything when I build the container. Inside an nginx alpine container, there is only the nginx.pid created by nginx inside that folder and since this is a tmpfs everything is lost on container reboot. On top of that, we are speaking about NGINX and docker alpine, so I pretty confident. This is not an official recommandation, but it can be used depending of your usecase (here that's only a reverse proxy + serves static files, there is no PHP or node.js execution).

@ndeloof
Copy link
Contributor

ndeloof commented Jun 14, 2021

tmpfs size can be set by Compose syntax using the long syntax https://github.com/compose-spec/compose-spec/blob/master/spec.md#long-syntax-4

@ndeloof ndeloof closed this as completed Jun 14, 2021
@serut
Copy link

serut commented Jun 14, 2021

@ndeloof you can reopen this ticket. We're here speaking about the mode (0777...), not the size !

@ndeloof ndeloof reopened this Jun 14, 2021
@ndeloof
Copy link
Contributor

ndeloof commented Jun 14, 2021

Right, but compose file syntax should be discussed under https://github.com/compose-spec/compose-spec

@ndeloof
Copy link
Contributor

ndeloof commented Jun 14, 2021

We can't transfert issues between docker github organization and compose-spec, please open an issue on the compose specification to discuss the need for the mode attribute. Once supported, we will be able to add support in docker/compose-cli (which is the right place to discuss compose subcommand).

@xeruf
Copy link

xeruf commented May 10, 2024

for people stumbling here, this is the current spec link ;) https://github.com/compose-spec/compose-spec/blob/master/spec.md#volumes

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

No branches or pull requests

7 participants