Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-1274

virtual/is_virtual does not detect docker anymore

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Fix
    • Affects Version/s: FACT 2.4.4
    • Fix Version/s: None
    • Component/s: Community
    • Labels:
    • Environment:

      Host : ubuntu 15.10
      Docker : 1.9.0

      Docker container : Debian wheezy - facter 2.4.4

    • Template:

      Description

      Inside a docker container (debian wheezy):

      root@docker1-wheezy:~# facter virtual
      physical
      root@docker1-wheezy:~# facter is_virtual
      false
      

      This is because output of cgroups in ubuntu 15.10 (at least) has changed:

      root@docker1-wheezy:~# cat /proc/1/cgroup
      10:hugetlb:/system.slice/docker-28c956314a24d47fdeac8455669aba0d9146dc5f48f12b28c676550e51d8d83b.scope
      9:blkio:/system.slice/docker-28c956314a24d47fdeac8455669aba0d9146dc5f48f12b28c676550e51d8d83b.scope
      8:memory:/system.slice/docker-28c956314a24d47fdeac8455669aba0d9146dc5f48f12b28c676550e51d8d83b.scope
      7:perf_event:/system.slice/docker-28c956314a24d47fdeac8455669aba0d9146dc5f48f12b28c676550e51d8d83b.scope
      6:freezer:/system.slice/docker-28c956314a24d47fdeac8455669aba0d9146dc5f48f12b28c676550e51d8d83b.scope
      5:cpu,cpuacct:/system.slice/docker-28c956314a24d47fdeac8455669aba0d9146dc5f48f12b28c676550e51d8d83b.scope
      4:cpuset:/system.slice/docker-28c956314a24d47fdeac8455669aba0d9146dc5f48f12b28c676550e51d8d83b.scope
      3:devices:/system.slice/docker-28c956314a24d47fdeac8455669aba0d9146dc5f48f12b28c676550e51d8d83b.scope
      2:net_cls,net_prio:/system.slice/docker-28c956314a24d47fdeac8455669aba0d9146dc5f48f12b28c676550e51d8d83b.scope
      1:name=systemd:/system.slice/docker-28c956314a24d47fdeac8455669aba0d9146dc5f48f12b28c676550e51d8d83b.scope
      

      So this does not match the :

            in_docker = path.readlines.any? {|l| l.split(":")[2].to_s.start_with? '/docker/' }
      

      in facter/util/virtual.rb anymore. I tested with :

            in_docker = path.readlines.any? {|l| l.split(":")[2].to_s =~ /\/docker/ }
      

      and it works correctly :

      root@docker1-wheezy:~# facter is_virtual
      true
      root@docker1-wheezy:~# facter virtual
      docker
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            Sp4rKy Maxence Dunnewind
            QA Contact:
            Eric Thompson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support