{"action":"opened","issue":{"url":"https://api.github.com/repos/HowardMei/s6-overlay/issues/1","labels_url":"https://api.github.com/repos/HowardMei/s6-overlay/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/HowardMei/s6-overlay/issues/1/comments","events_url":"https://api.github.com/repos/HowardMei/s6-overlay/issues/1/events","html_url":"https://github.com/HowardMei/s6-overlay/issues/1","id":81773549,"number":1,"title":"Limitations to init scripts inside cont-init.d and cont-finish.d","user":{"login":"HowardMei","id":1254933,"avatar_url":"https://avatars.githubusercontent.com/u/1254933?v=3","gravatar_id":"","url":"https://api.github.com/users/HowardMei","html_url":"https://github.com/HowardMei","followers_url":"https://api.github.com/users/HowardMei/followers","following_url":"https://api.github.com/users/HowardMei/following{/other_user}","gists_url":"https://api.github.com/users/HowardMei/gists{/gist_id}","starred_url":"https://api.github.com/users/HowardMei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HowardMei/subscriptions","organizations_url":"https://api.github.com/users/HowardMei/orgs","repos_url":"https://api.github.com/users/HowardMei/repos","events_url":"https://api.github.com/users/HowardMei/events{/privacy}","received_events_url":"https://api.github.com/users/HowardMei/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-28T05:42:59Z","updated_at":"2015-05-28T05:42:59Z","closed_at":null,"body":"In fact, the limitations apply to all init scripts inside docker container due to  docker [issue #1916](https://github.com/docker/docker/issues/1916).  \r\n\r\nFor instance, following init scripts will all encounter the same error: `mount: mounting cgroup on /sys/fs/cgroup failed: Permission denied`:  \r\n\r\n```\r\n#!/bin/sh\r\nmount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup```  \r\n\r\n```\r\n#!/usr/bin/execlineb -P\r\ns6-setuidgid root mount  -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup```  \r\n\r\n```\r\n#!/usr/bin/execlineb -P\r\ns6-envuidgid -D 0:0 root\r\ns6-applyuidgid -U\r\ns6-chown -u 0 -g 0 /usr/bin/cgroupfs-mount\r\ncgroupfs-mount```\r\n\r\n```\r\n#!/bin/sh\r\nexec s6-setuidgid root mount  -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup```  \r\n\r\nif you run the image without `--privileged=true` option.  \r\n\r\nThere is no `docker build --privileged=true` feature yet. We have tow possible ways to make it work:  \r\n#1 \r\n`docker run --rm --privileged=true -it yourimage cmds`  \r\n#2 \r\nstart your container with --name option, with `--privileged=true`, one-shot, to mount the cgroupfs and produce the right `/sys/fs/cgroup` conf;  \r\nstart your actual working container to run the service daemon with `/sys/fs/cgroup` volume imported  from the first named container. \r\n\r\n\r\n"}}