Determines whether the server has a Docker image with a given name.
16099
def has_image(self, name: str) -> bool:
        
        path = "docker/images/{}".format(name)
        r = self.__api.head(path)
        if r.status_code == 204:
            return True
        elif r.status_code == 404:
            return False
        self.__api.handle_erroneous_response(r)
126715
def _has_name(soup_obj):
    """"""
    try:
        name = soup_obj.name
        if name == None:
            return False
        return True
    except AttributeError:
        return False
1318109
async def export_image(self, name: str):
        
        response = await self.docker._query(
            "images/{name}/get".format(name=name), "GET"
        )
        return response.content
335295
def container_exists(self, id=None, name=None):
        
        exists = False
        if id and self.container_by_id(id):
            exists = True
        elif name and self.container_by_name(name):
            exists = True

        return exists
1351066
def pull_image(self, name, tag='latest'):
        
        name = "{0}/{1}:{2}".format(DOCKER_NEG, name, tag)
        return "/dockerapi/v2/images", dict(image=name)
888522
def guess_server_name():
    """"""
    if   os.environ.get('CSCSERVICE')          == 'sisu':         return "sisu"
    elif os.environ.get('SLURM_JOB_PARTITION') == 'halvan':       return "halvan"
    elif os.environ.get('SNIC_RESOURCE')       == 'milou':        return "milou"
    elif os.environ.get('LAPTOP')              == 'macbook_air':  return "macbook_air"
    else:                                                         return "unknown"
447152
def image_exists(self, image_name, tag='latest'):
        
        code, image = self.image_tags(image_name)
        if code != httplib.OK:
            return False
        tag = tag.lower()
        return any(x.lower() == tag for x in image.tags)
227914
def update_image_2(self, container_name, image_name):
        
        code, container = self.get_container(container_name)
        if code == httplib.NOT_FOUND:
            raise ContainerNotFound(container_name)
        elif code != httplib.OK:
            raise GeneralError(code)

        _, old_image_name, _ = utils.parse_image_name(container.image)
        repository, name, version = utils.parse_image_name(image_name)
        if not repository or repository.lower() != DOCKER_NEG:
            image_name = '{0}/{1}:{2}'.format(DOCKER_NEG, name, version)

        if not repo.image_exists(name, tag=version):
            raise ImageNotFound("{0} do not location in docker.neg repository.".format(image_name))

        if old_image_name.lower() != name.lower():
            raise ImageConflict("{0} is not be same with container's Image.".format(image_name))

        code, result = self.pull_image(name, version)
        if code != httplib.OK:
            raise GeneralError(
                'pull image {0}:{1} failure, status code {2}, result: {3}'.format(name, version, code, result))

        code, result = self.update(container_name, tag=version)
        if code != httplib.OK:
            raise GeneralError(
                'Update container {0} failure, status code {1}, result: {2}'.format(container_name, code, result))

        return True
8770
function checkImageExist(opts = { cwd: './', appConfig: null }) {
    if (this.abort) return;

    let imagePath = '';
    this.warning = false;
    this.warningMessage = 'To generate the missing Docker image(s), please run:\n';
    if (opts.appConfig.buildTool === 'maven') {
        imagePath = this.destinationPath(`${opts.cwd + opts.cwd}/target/docker`);
        this.dockerBuildCommand = './mvnw -Pprod verify jib:dockerBuild';
    } else {
        imagePath = this.destinationPath(`${opts.cwd + opts.cwd}/build/docker`);
        this.dockerBuildCommand = './gradlew bootWar -Pprod jibDockerBuild';
    }

    if (shelljs.ls(imagePath).length === 0) {
        this.warning = true;
        this.warningMessage += `  ${chalk.cyan(this.dockerBuildCommand)} in ${this.destinationPath(this.directoryPath + opts.cwd)}\n`;
    }
}
375541
private boolean hasSomeDataInternal(boolean image) throws IOException {
    QuorumCall<AsyncLogger, Boolean> call = image ? loggers.isImageFormatted() :
        loggers.isJournalFormatted();

    try {
      call.waitFor(loggers.size(), 0, 0, hasDataTimeoutMs, "hasSomeData");
    } catch (InterruptedException e) {
      throw new IOException("Interrupted while determining if JNs have data");
    } catch (TimeoutException e) {
      throw new IOException("Timed out waiting for response from loggers");
    }
    
    if (call.countExceptions() > 0) {
      call.throwQuorumException(
          "Unable to check if JNs are ready for formatting");
    }
    
    // If any of the loggers returned with a non-empty manifest, then
    // we should prompt for format.
    for (Boolean hasData : call.getResults().values()) {
      if (hasData) {
        return true;
      }
    }

    // Otherwise, none were formatted, we can safely format.
    return false;
  }
1272605
def check_virtualserver(self, name):
        '''
        
        '''
        vs = self.bigIP.LocalLB.VirtualServer
        for v in vs.get_list():
            if v.split('/')[-1] == name:
                return True
        return False
1287336
def rbd_exists(service, pool, rbd_img):
    """"""
    try:
        out = check_output(['rbd', 'list', '--id',
                            service, '--pool', pool])
        if six.PY3:
            out = out.decode('UTF-8')
    except CalledProcessError:
        return False

    return rbd_img in out
1078493
def _get_local_image_id(docker_binary, docker_tag):
    
    cmd = [docker_binary, "images", "-q", docker_tag]
    image_id_b = check_output(cmd)
    image_id = image_id_b.decode('utf-8').strip()
    if not image_id:
        raise RuntimeError('Unable to find docker image id matching with tag {}'.format(docker_tag))
    return image_id
328775
def image_by_name(img_name, images=None):
    
    i_reg, i_rep, i_tag = _decompose(img_name)

    # Correct for bash-style matching expressions.
    if not i_reg:
        i_reg = '*'
    if not i_tag:
        i_tag = '*'

    # If the images were not passed in, go get them.
    if images is None:
        c = docker.Client(**kwargs_from_env())
        images = c.images(all=False)

    valid_images = []
    for i in images:
        for t in i['RepoTags']:
            reg, rep, tag = _decompose(t)
            if matches(reg, i_reg) \
                    and matches(rep, i_rep) \
                    and matches(tag, i_tag):
                valid_images.append(i)
                break
            # Some repo after decompose end up with the img_name
            # at the end.  i.e. rhel7/rsyslog
            if rep.endswith(img_name):
                valid_images.append(i)
                break
    return valid_images
605022
def container_by_name(self, name):
        
        if not name:
            return None

        # docker prepends a '/' to container names in the container dict
        name = '/'+name
        return next((container for container in self.containers(all=True)
                     if name in container['Names']), None)
1103450
public function nameExists()
    {
        $name = (string) $this->getRequiredParameter('name');
        if (empty($name))
            return false;

        return array_key_exists($name, $this->_imageNames);
    }
68354
def tag_image(self, repository=None, tag=None):
        
        if not (repository or tag):
            raise ValueError("You need to specify either repository or tag.")
        r = repository or self.name
        t = "latest" if not tag else tag
        self.d.tag(image=self.get_full_name(), repository=r, tag=t)
        return DockerImage(r, tag=t)