def get_docker_id(self, get_exited=False):
        """Returns first 12 characters of LXC container ID.

        (as returned by the 'docker ps' command)

        :param get_exited:
        :return:
        """

        up = self.ssh_command(
            'docker ps -a | grep -i %s | grep Up | cut -f 1 -d " "' %
            self.container
        ).decode('utf-8')

        self.print_debug('FOUND CONTAINERS: %r' % up)

        if not up and get_exited:
            self.print_debug('Container not Up, trying Exited')

            up = self.ssh_command(
                'docker ps -a | grep -i %s | grep Exited | cut -f 1 -d " "' %
                self.container
            ).decode('utf-8')

            self.print_debug('FOUND CONTAINERS: %r' % up)

            if not up:
                raise exc.DockerError(
                    "Container '%s' not found or not functional" %
                    self.container
                )

        return up
dataset/ETHPy150Open openstack/fuel-dev-tools/fuel_dev_tools/docker/__init__.py/DockerMixin.get_docker_id/original