当前位置: 首页>>代码示例>>Java>>正文


Java Container.names方法代码示例

本文整理汇总了Java中com.spotify.docker.client.messages.Container.names方法的典型用法代码示例。如果您正苦于以下问题:Java Container.names方法的具体用法?Java Container.names怎么用?Java Container.names使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.spotify.docker.client.messages.Container的用法示例。


在下文中一共展示了Container.names方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cleanDocker

import com.spotify.docker.client.messages.Container; //导入方法依赖的package包/类
private void cleanDocker(Set<String> runningTaskIds) {
  try {
    for (Container container : dockerUtils.listContainers()) {
      for (String name : container.names()) {
        if (name.startsWith(executorConfiguration.getDockerPrefix())) {
          if (!runningTaskIds.contains(name.substring(executorConfiguration.getDockerPrefix().length()))) {
            stopContainer(container);
          }
        }
      }
    }
  } catch (Exception e) {
    LOG.error("Could not get list of Docker containers", e);
    exceptionNotifier.notify(e, Collections.<String, String>emptyMap());
  }
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:17,代码来源:SingularityExecutorCleanup.java

示例2: cleanDocker

import com.spotify.docker.client.messages.Container; //导入方法依赖的package包/类
private void cleanDocker(Set<String> runningTaskIds) {
  try {
    for (Container container : dockerUtils.listContainers()) {
      for (String name : container.names()) {
        if (name.startsWith(executorConfiguration.getDockerPrefix())) {
          if (!runningTaskIds.contains(name.substring(executorConfiguration.getDockerPrefix().length()))) {
            stopContainer(container);
          }
        }
      }
    }
  } catch (Exception e) {
    LOG.error("Could not get list of Docker containers", e);
    exceptionNotifier.notify(String.format("Error listing docker containers (%s)", e.getMessage()), e, Collections.<String, String>emptyMap());
  }
}
 
开发者ID:HubSpot,项目名称:Singularity,代码行数:17,代码来源:SingularityExecutorCleanup.java

示例3: getContainerId

import com.spotify.docker.client.messages.Container; //导入方法依赖的package包/类
@Override
public String getContainerId(String name) {
    String extName = "/" + name;
    List<Container> containers = getContainers();
    for (Container container : containers) {
        for (String containerName : container.names()) {
            // Clean name from Swarm node names if needed
            String cleanedName = containerName.replaceAll("/.+?/", "/");
            if (cleanedName.equals(name) || cleanedName.equals(extName)) {
                return container.id();
            }
        }
    }
    return null;
}
 
开发者ID:hobbit-project,项目名称:platform,代码行数:16,代码来源:ContainerManagerImpl.java

示例4: convert

import com.spotify.docker.client.messages.Container; //导入方法依赖的package包/类
public static DockerContainerElement convert(Container container) {
	if (container == null)
		return null;

	String command = container.command();
	String id = container.id();
	String image = container.image();
	List<String> names = container.names();
	Long created = container.created();
	Long sizeRootFs = container.sizeRootFs();
	Long sizeRw = container.sizeRw();
	String status = container.status();
	List<PortMapping> ports = container.ports();

	DockerContainerElement e = new DockerContainerElement();
	e.setCommand(command);
	e.setId(id);
	e.setImage(image);
	e.setNames(names);
	java.util.Date dt = new java.util.Date(created * 1000);
	SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm");
	e.setCreated(sdf.format(dt));
	e.setSizeRootFs(sizeRootFs);
	e.setSizeRw(sizeRw);
	e.setStatus(status);
	e.setPorts(ports);

	return e;
}
 
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:30,代码来源:DomainHelper.java


注:本文中的com.spotify.docker.client.messages.Container.names方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。