Check if I am running inside a Linux container.
547085
def is_containerized() -> bool:
    '''
    
    '''
    try:
        cginfo = Path('/proc/self/cgroup').read_text()
        if '/docker/' in cginfo or '/lxc/' in cginfo:
            return True
    except IOError:
        return False
1177639
def ls(self, what):
        """"""
        for i in getattr(self.system, what):
            self.logger.info('%s: %s: %s', i.__class__.__name__, i, i.status)
        return True
201253
def check_starting!(service_pod, container)
      raise "service stopped" if !@service_pod.running?
      raise "service redeployed" if @service_pod.deploy_rev != service_pod.deploy_rev
      raise "container recreated" if @container.id != container.id
      raise "container restarted" if @container.started_at != container.started_at
    end
1245696
def process_running?(pid)
      return false unless pid
      Process.getpgid(pid) != -1
    rescue Errno::ESRCH
      false
    end
565424
def is_running(pid):
    
    process = get_process(pid)
    if process and process.is_running() and process.status() != "zombie":
        return True
    else:
        return False
780235
def is_pod_running(self, pod):
        
        # FIXME: Validate if this is really the best way
        is_running = (
            pod is not None and
            pod.status.phase == 'Running' and
            pod.status.pod_ip is not None and
            pod.metadata.deletion_timestamp is None and
            all([cs.ready for cs in pod.status.container_statuses])
        )
        return is_running
1094506
protected function detectRunningInHook()
    {
        $envPrefix = $this->config()->get('service.env_prefix');
        if (getenv($envPrefix . 'PROJECT')
            && basename(getenv('SHELL')) === 'dash'
            && !$this->isTerminal(STDIN)) {
            return true;
        }

        return false;
    }
82448
def is_alive(self, container: Container) -> bool:
        
        uid = container.uid
        return uid in self.__dockerc and \
               self.__dockerc[uid].status == 'running'
329909
def _is_pid_running_on_windows(pid):
    
    import ctypes.wintypes

    kernel32 = ctypes.windll.kernel32
    handle = kernel32.OpenProcess(1, 0, pid)
    if handle == 0:
        return False
    exit_code = ctypes.wintypes.DWORD()
    ret = kernel32.GetExitCodeProcess(handle, ctypes.byref(exit_code))
    is_alive = (ret == 0 or exit_code.value == _STILL_ALIVE)  # pylint: disable=undefined-variable
    kernel32.CloseHandle(handle)
    return is_alive
981674
def _check_pid(self, allow_reset=False):
        """"""
        if not self.pid == current_process().pid:
            if allow_reset:
                self.reset()
            else:
                raise RuntimeError("Forbidden operation in multiple processes")
105308
def is_running(self):
        
        return self._process.state() in [self._process.Running, self._process.Starting]
945882
def run_container():
    """"""

    os.chdir(my_directory)

    cmd = [
        'docker', 'run',
        '-it', '--rm',
        '-v', '{}:/cauldron'.format(my_directory),
        '-p', '5010:5010',
        'cauldron_app',
        '/bin/bash'
    ]

    return os.system(' '.join(cmd))
131701
def is_system_rpm(self):
        """"""
        sys_rpm_paths = [
            '/usr/bin/rpm',
            # On CentOS6, system RPM is installed in this directory.
            '/bin/rpm',
        ]
        matched = False
        for sys_rpm_path in sys_rpm_paths:
            if self.rpm_path.startswith(sys_rpm_path):
                matched = True
                break
        return matched
579399
public function hasActualContainer(): bool
    {
        if (false === $this->environment->isDebug())
        {
            return true === $this->configCache()->isFresh();
        }

        return false;
    }
1126520
public function isRunning()
    {
        if ($this->process === null) {
            return false;
        }

        $status = proc_get_status($this->process);
        if ($status && $status['running'] === false && $this->exitcode === null) {
            $this->exitcode = $status['exitcode'];
            // Note that you can not use proc_get_status to determine the PID because proc_open first launches a shell (sh)
            // whose PID is returned!
        }

        return $status && $status['running'];
    }
1158915
private boolean isRunContainer(int i, boolean hasrun) {
    if (hasrun) { // info is in the buffer
      int j = buffer.get(startofrunbitmap + i / 8);
      int mask = 1 << (i % 8);
      return (j & mask) != 0;
    } else {
      return false;
    }
  }
459434
def is_running(self):
        
        return self._state in [self.STATE_ACTIVE,
                               self.STATE_IDLE,
                               self.STATE_INITIALIZING]