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

Provide a way to override setting tmpfs #38

Closed
kevinanderson1 opened this issue Dec 20, 2016 · 11 comments
Closed

Provide a way to override setting tmpfs #38

kevinanderson1 opened this issue Dec 20, 2016 · 11 comments

Comments

@kevinanderson1
Copy link

I am unsure of who the best people would be to fix this particular issue but I figured I would start here. After upgrading to Fedora 25 and switching to the Fedora provided Docker version I started having issues running Plex in a container due to permission errors (specifically exec permissions on files in /run).

After digging I found that it was related to oci-systemd-hook which sets /run to noexec and tmpfs. The main issue that I am hitting is the image (docker.io/linuxserver/plex) is using s6-overlay with an entrypoint of /init. From what I can tell, this causes oci-systemd-hook to think that it is booting a systemd container and setting /run to tmpfs.

Is it possible to override the hook on a per-container basis? While I could remove the hook completely I do want to test some use cases that use systemd in a container so it would be beneficial to keep if possible.

Thanks!

@rhatdan
Copy link
Member

rhatdan commented Dec 20, 2016

I actually think having noexec on /run is a bug.
If /run on my host does not have this set, we should not set it in oci-systemd-hook.
I will open a pull request to remove the noexec.

You could volume mount in a directory on /run to see if the app will work fine, with oci-systemd-hook.
-v /run/myapp:/run:Z

oci-systemd-hook looks for a program running "init" or systemd, if you could change this name to something else it would not happen.

@kevinanderson1
Copy link
Author

kevinanderson1 commented Dec 20, 2016 via email

@rhatdan
Copy link
Member

rhatdan commented Dec 20, 2016

Of volume mounting over /run still gets a tmpfs mounted over it, then that is another bug. If a user uses a volume mount, we should not mount over it.

@rhatdan
Copy link
Member

rhatdan commented Dec 20, 2016

Looks like we have code that checks for whether or not the /run directory is a mount point and then does not create a tmpfs mount. What version of oci-systemd-hook are you using?

@kevinanderson1
Copy link
Author

kevinanderson1 commented Dec 20, 2016 via email

@rhatdan
Copy link
Member

rhatdan commented Dec 20, 2016

Well /run/secrets would still get mounted but /run should be a bind mount not a tmpfs mount.

@kevinanderson1
Copy link
Author

So I did some more testing and here are the results. Also here is the version information:

Name : oci-systemd-hook
Version : 0.1.4
Release : 3.git41491a3.fc25

docker run -d -v /run/app:/run:Z --name plex docker.io/linuxserver/plex:latest
(SUCCESS) Results from mount | grep /run
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)

docker run -d --tmpfs /run:rw,nosuid,nodev,mode=755 --name plex docker.io/linuxserver/plex:latest
(FAIL) Results from mount | grep /run with context removed
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=65536k,mode=755)

Your initial suggestion of doing a volume mount does in fact work. I was trying to use the --tmpfs command line option that I found in the Docker documentation (https://docs.docker.com/engine/reference/commandline/run/#/mount-tmpfs---tmpfs).

Should that command line flag also disable the mounting of /run with restrictive permissions to respect what the user provided?

@rhatdan
Copy link
Member

rhatdan commented Dec 20, 2016

We have fixes merged for the first two issues, we no longer mount as NOEXEC and we check to make sure the max size of tmpfs is no larger then 50% of total memory.
We will look to fix the --tmpfs issue tomorrow and then put out a new oci-systemd-hook. Thanks for your effort in discovering these issues.

@kevinanderson1
Copy link
Author

Thanks for the quick response and help with this!

@hogarthj
Copy link

Just to keep things linked up ...

https://bugzilla.redhat.com/show_bug.cgi?id=1406830 <-- fedora bug about the --tmpfs issue

This has some more detail about it and it surrounds the code looking in the mounts part of the json but --tmpfs actually populating the tmpfs part and not the mounts part ... when you use -v to create a volume it appears in mounts

@rhatdan
Copy link
Member

rhatdan commented Jul 13, 2017

We now support keeping the tmpfs

@rhatdan rhatdan closed this as completed Jul 13, 2017
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

3 participants