moby: Docker in Docker - failed to find the cgroup root

Hi all,

I am running 1.3 on RHEL7 with a priv container running ubuntu 14:04 and 1.3 under it. Everything is running, however, in jenkins (the container running docker within), I am getting the following:

Sending build context to Docker daemon 
Step 0 : FROM ubuntu:latest
 ---> 5506de2b643b
Step 1 : MAINTAINER Aaron Nicoli <aaronnicoli@gmail.com>
 ---> Running in 88aa05a47854
 ---> 23620994a830
Removing intermediate container 88aa05a47854
Step 2 : ENV DEBIAN_FRONTEND noninteractive
 ---> Running in 8462b83bec13
 ---> 6aa5870a3b2d
Removing intermediate container 8462b83bec13
Step 3 : RUN rm -f /etc/localtime
 ---> Running in 0f2bcc9197b8
Removing intermediate container 0f2bcc9197b8
2014/10/27 14:12:23 failed to find the cgroup root
Build step 'Execute shell' marked build as failure
Finished: FAILURE

Any thoughts? I can’t see any issues, but, then again… I am no expert.

root@02eff186c45b:/# df -h
Filesystem                                                                                        Size  Used Avail Use% Mounted on
/dev/mapper/docker-8:49-1310721-02eff186c45bd6dd568a909b7fb7e86cd92a8599b2921c6e558ad21627a705cf  9.8G  735M  8.5G   8% /
tmpfs                                                                                             3.9G     0  3.9G   0% /dev
shm                                                                                                64M     0   64M   0% /dev/shm
/dev/sdd1                                                                                          40G  3.6G   34G  10% /etc/hosts
/dev/sdc1                                                                                          16G  491M   15G   4% /var/jenkins_home
cgroup                                                                                            3.9G     0  3.9G   0% /sys/fs/cgroup

I have /var/lib/docker listed as a volume in the Dockerfile (that the jenk container was built from).

Aaron.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 22 (5 by maintainers)

Commits related to this issue

Most upvoted comments

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
        )
}

~                                                                                                                                                                                                           
~                                                                                                                                                                                                           
root@7737ff9e148f:~# source cgroup.sh 
root@7737ff9e148f:~# cgroup 
cgroupfs_mount  cgroups-mount   cgroups-umount  
root@7737ff9e148f:~# cgroupfs_mount 
mount: cgroup already mounted or cpu busy
mount: according to mtab, cgroup is mounted on /sys/fs/cgroup
mount: cgroup already mounted or cpuacct busy
mount: according to mtab, cgroup is mounted on /sys/fs/cgroup
mount: cgroup already mounted or net_cls busy
mount: according to mtab, cgroup is mounted on /sys/fs/cgroup
mount: cgroup already mounted or net_prio busy
mount: according to mtab, cgroup is mounted on /sys/fs/cgroup
root@7737ff9e148f:~# mount
/dev/sdb on / type btrfs (rw,relatime,space_cache)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev type tmpfs (rw,nosuid,mode=755)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=65536k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
/dev/sdb on /etc/resolv.conf type btrfs (rw,relatime,space_cache)
/dev/sdb on /etc/hostname type btrfs (rw,relatime,space_cache)
/dev/sdb on /etc/hosts type btrfs (rw,relatime,space_cache)
/dev/sdb on /var/lib/docker type btrfs (rw,relatime,space_cache)
cgroup on /sys/fs/cgroup type tmpfs (rw,relatime,mode=755)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,relatime,cpuset)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,relatime,freezer)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,relatime,perf_event)
/dev/sdb on /var/lib/docker/btrfs type btrfs (rw,relatime,space_cache)
root@7737ff9e148f:~# umount /sys/fs/cgroup/cpu
umount: /sys/fs/cgroup/cpu: not found
root@7737ff9e148f:~# cgroupfs_mount           
mount: cgroup already mounted or cpu busy
mount: according to mtab, cgroup is mounted on /sys/fs/cgroup
mount: cgroup already mounted or cpuacct busy
mount: according to mtab, cgroup is mounted on /sys/fs/cgroup
mount: cgroup already mounted or net_cls busy
mount: according to mtab, cgroup is mounted on /sys/fs/cgroup
mount: cgroup already mounted or net_prio busy
mount: according to mtab, cgroup is mounted on /sys/fs/cgroup

This may help in debugging. Host docker is CoreOS 472 and guest docker is dockerhub:flitter/builder:master

For anyone who may be having or is still having this issue on a RHEL server, would you be able to verify if the libcgroup package is installed using sudo yum list installed libcgroup? If it isn’t try installing it (sudo yum install libcgroup).

Assuming it is installed already, first of all, check the status:

$ sudo /etc/init.d/cgconfig status
Running

If it is stopped, start it:

$ sudo /etc/init.d/cgconfig start
Starting cgconfig service:                                 [  OK  ]

If it is already running, restart it:

$ sudo /etc/init.d/cgconfig restart
Stopping cgconfig service:                                 [  OK  ]
Starting cgconfig service:                                 [  OK  ]

The docker init script /etc/init.d/docker requires that the cgconfig service be started but it sounds like one (or more) of the cgroup filesystems becomes unconfigured for whatever reason after the service is started so restarting it ought to resolve the issues.

If it doesn’t, could someone post their /etc/cgconfig.conf and check to see if there are any files in /etc/cgconfig.d?

Thanks for this - this made docker-in-docker work for me:

https://github.com/ianmiell/shutit/commit/3d7238f02c23c40a34c5000c4e88f64565c3685c#diff-469a2a5ebd309b7bea7966e84b092112

Sending you a virtual beer/coffee/the purest water.