Skip to content

Instantly share code, notes, and snippets.

@feitang0
Created November 30, 2015 12:07
Show Gist options
  • Save feitang0/5fdca2ef0ec30b486fe0 to your computer and use it in GitHub Desktop.
Save feitang0/5fdca2ef0ec30b486fe0 to your computer and use it in GitHub Desktop.
Devices cgroup isn't mounted
# From: https://github.com/docker/docker/issues/8791
cgroupfs_mount() {
# see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount
if grep -v '^#' /etc/fstab | grep -q cgroup \
|| [ ! -e /proc/cgroups ] \
|| [ ! -d /sys/fs/cgroup ]; then
return
fi
if ! mountpoint -q /sys/fs/cgroup; then
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
fi
(
cd /sys/fs/cgroup
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
mkdir -p $sys
if ! mountpoint -q $sys; then
if ! mount -n -t cgroup -o $sys cgroup $sys; then
rmdir $sys || true
fi
fi
done
)
}
@propochThai
Copy link

Thanks.. Your code can help fixed the issue...
I spend time more than 2 hour find how to fixed. but it cannot until I found your code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment