• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ContainerConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.github.dockerjava.api.model.ContainerConfig的典型用法代码示例。如果您正苦于以下问题:Java ContainerConfig类的具体用法?Java ContainerConfig怎么用?Java ContainerConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ContainerConfig类属于com.github.dockerjava.api.model包,在下文中一共展示了ContainerConfig类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getDockerEvent

import com.github.dockerjava.api.model.ContainerConfig; //导入依赖的package包/类
private DockerEvent getDockerEvent(String containerId){
	DockerEvent result = null;
	try{
		InspectContainerResponse inspectResponse = dockerClient.inspectContainerCmd(containerId).exec();
		ContainerConfig config = inspectResponse.getConfig();
		Map<String,String> labels = config.getLabels();
		String taskId = labels.get(TASK_ID);
		if(this.taskId.getValue().equals(taskId)){
			ContainerState state = inspectResponse.getState();
			String name = inspectResponse.getName();
			int exitCode = state.getExitCode();
			int pid = state.getPid();
			result= new DockerEvent(containerId, name, pid, exitCode);
		}
	}catch(NotFoundException exception){
		log.debug("tried to debug non-existent containerId",exception);
	}
	return result;
}
 
开发者ID:mohitsoni,项目名称:compose-executor,代码行数:20,代码来源:DockerEventObserver.java


示例2: setNetworkMode

import com.github.dockerjava.api.model.ContainerConfig; //导入依赖的package包/类
private void setNetworkMode(Instance instance, ContainerConfig containerConfig, HostConfig hostConfig) {
    if(DataAccessor.fields(instance).withKey(FIELD_NETWORK_MODE).get() != null)
        return;

    String netMode = null;
    if (containerConfig != null && containerConfig.isNetworkDisabled()) {
        netMode = NetworkConstants.NETWORK_MODE_NONE;
    } else if (hostConfig != null) {
        String inspectNetMode = hostConfig.getNetworkMode();
        if (NetworkConstants.NETWORK_MODE_BRIDGE.equals(inspectNetMode) ||
                NetworkConstants.NETWORK_MODE_HOST.equals(inspectNetMode) ||
                NetworkConstants.NETWORK_MODE_NONE.equals(inspectNetMode)) {
            netMode = inspectNetMode;
        } else if (NetworkConstants.NETWORK_MODE_DEFAULT.equals(inspectNetMode) || StringUtils.isBlank(inspectNetMode)) {
            netMode = NetworkConstants.NETWORK_MODE_BRIDGE;
        } else if (StringUtils.startsWith(inspectNetMode, NetworkConstants.NETWORK_MODE_CONTAINER)) {
            throw new ClientVisibleException(ResponseCodes.UNPROCESSABLE_ENTITY, ValidationErrorCodes.INVALID_OPTION,
                    "Transformer API does not support container network mode.", null);
        } else {
            throw new ClientVisibleException(ResponseCodes.UNPROCESSABLE_ENTITY, ValidationErrorCodes.INVALID_OPTION,
                    "Unrecognized network mode: " + inspectNetMode, null);
        }
    }

    setField(instance, FIELD_NETWORK_MODE, netMode);
}
 
开发者ID:rancher,项目名称:cattle,代码行数:27,代码来源:DockerTransformerImpl.java


示例3: inspect

import com.github.dockerjava.api.model.ContainerConfig; //导入依赖的package包/类
@Override
public KieContainerDetails inspect(String containerId) {

    Timer timer = new Timer();
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Start inspecting container with id = " + containerId);
        timer.start();
    }
    
    final DockerClient dockerClient = getClient();
    final InspectContainerResponse response = dockerClient.inspectContainerCmd(containerId).exec();
    final NetworkSettings networkSettings = response.getNetworkSettings();
    final ContainerConfig config = response.getConfig();
    final String[] envVars = config.getEnv();
    final InspectContainerResponse.ContainerState state = response.getState();
    final String ipAddress = networkSettings.getIpAddress();
    final int containerPid = state.getPid();
    final String containerStartedAt = state.getStartedAt();
    final String containerFinishedAt = state.getFinishedAt();
    final Map<String, Map<String, String>> portMappings = networkSettings.getPortMapping();
    final String[] containerArgs = response.getArgs();
    
    final KieContainerDetails details = new KieContainerDetails();
    details.setIpAddress(ipAddress);
    details.setContainerPid(containerPid);
    details.setContainerStartedAt(containerStartedAt);
    details.setContainerFinishedAt(containerFinishedAt);
    details.setPortMappings(portMappings);
    details.setContainerArgs(containerArgs);
    details.setEnvVars(escapeEnvVars(envVars));

    if (LOGGER.isDebugEnabled()) {
        timer.end();
        LOGGER.debug("container with id = " + containerId + " inspected. Elapsed time = " + timer.getTotalTime());
    }
    
    return details;
}
 
开发者ID:kiegroup,项目名称:kie-docker-ci,代码行数:39,代码来源:DockerServiceImpl.java


示例4: setExposed

import com.github.dockerjava.api.model.ContainerConfig; //导入依赖的package包/类
@Override
public void setExposed(Instance instance, Map<String, Object> fromInspect) {
    InspectContainerResponse inspect = transformInspect(fromInspect);
    ContainerConfig containerConfig = inspect.getConfig();
    HostConfig hostConfig = inspect.getHostConfig();

    if (containerConfig != null && hostConfig != null) {
        setExposed(instance, safeGetExposedPorts(containerConfig));
    }

}
 
开发者ID:rancher,项目名称:cattle,代码行数:12,代码来源:DockerTransformerImpl.java


示例5: safeGetExposedPorts

import com.github.dockerjava.api.model.ContainerConfig; //导入依赖的package包/类
private ExposedPort[] safeGetExposedPorts(ContainerConfig containerConfig) {
    try {
        return containerConfig.getExposedPorts();
    } catch (NullPointerException e) {
        // Bug in docker-java doesn't account for this property being null
        return null;
    }
}
 
开发者ID:rancher,项目名称:cattle,代码行数:9,代码来源:DockerTransformerImpl.java


示例6: getConfig

import com.github.dockerjava.api.model.ContainerConfig; //导入依赖的package包/类
public ContainerConfig getConfig() {
    return config;
}
 
开发者ID:rancher,项目名称:cattle,代码行数:4,代码来源:InspectContainerResponse.java


示例7: getConfig

import com.github.dockerjava.api.model.ContainerConfig; //导入依赖的package包/类
/**
 * Get the image commit configuration
 * @see #config
 */
@CheckForNull
public ContainerConfig getConfig() {
    return config;
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:9,代码来源:InspectImageResponse.java


示例8: withConfig

import com.github.dockerjava.api.model.ContainerConfig; //导入依赖的package包/类
/**
 * @see #config
 */
public InspectImageResponse withConfig(ContainerConfig config) {
    this.config = config;
    return this;
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:8,代码来源:InspectImageResponse.java


示例9: withContainerConfig

import com.github.dockerjava.api.model.ContainerConfig; //导入依赖的package包/类
/**
 * @see #containerConfig
 */
public InspectImageResponse withContainerConfig(ContainerConfig containerConfig) {
    this.containerConfig = containerConfig;
    return this;
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:8,代码来源:InspectImageResponse.java


示例10: getImageConfig

import com.github.dockerjava.api.model.ContainerConfig; //导入依赖的package包/类
private ContainerConfig getImageConfig() {
    return this.actual.getConfig();
}
 
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:4,代码来源:ImageAssert.java


示例11: getContainerConfig

import com.github.dockerjava.api.model.ContainerConfig; //导入依赖的package包/类
private ContainerConfig getContainerConfig() {
    return this.actual.getConfig();
}
 
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:4,代码来源:ContainerAssert.java


示例12: getContainerConfig

import com.github.dockerjava.api.model.ContainerConfig; //导入依赖的package包/类
/**
 * If the image was created from a container, this config contains the configuration of the container
 * which was committed in this image
 * @see #containerConfig
 */
@CheckForNull
public ContainerConfig getContainerConfig() {
    return containerConfig;
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:10,代码来源:InspectImageResponse.java



注:本文中的com.github.dockerjava.api.model.ContainerConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RefreshLogRetentionSettingsRequestProto类代码示例发布时间:2022-05-23
下一篇:
Java EuclideanDistanceMeasure类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap