本文整理汇总了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());
}
}
示例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());
}
}
示例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;
}
示例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;
}