當前位置: 首頁>>代碼示例>>Java>>正文


Java NetworkConfig類代碼示例

本文整理匯總了Java中com.spotify.docker.client.messages.NetworkConfig的典型用法代碼示例。如果您正苦於以下問題:Java NetworkConfig類的具體用法?Java NetworkConfig怎麽用?Java NetworkConfig使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


NetworkConfig類屬於com.spotify.docker.client.messages包,在下文中一共展示了NetworkConfig類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createNetwork

import com.spotify.docker.client.messages.NetworkConfig; //導入依賴的package包/類
@Override
public NetworkCreation createNetwork(NetworkConfig nc) {
    throw new IllegalStateException(DISCONNECTED); 
}
 
開發者ID:amihaiemil,項目名稱:comdor,代碼行數:5,代碼來源:Disconnected.java

示例2: ContainerManagerImpl

import com.spotify.docker.client.messages.NetworkConfig; //導入依賴的package包/類
/**
 * Constructor that creates new docker client instance
 */
public ContainerManagerImpl() throws Exception {
    LOGGER.info("Deployed as \"{}\".", DEPLOY_ENV);
    Builder builder = DefaultDockerClient.fromEnv();
    builder.connectionPoolSize(5000);
    builder.connectTimeoutMillis(1000);
    dockerClient = builder.build();

    String username = System.getenv(USER_NAME_KEY);
    String email = System.getenv(USER_EMAIL_KEY);
    String password = System.getenv(USER_PASSWORD_KEY);
    String registryUrl = System.getenv().containsKey(REGISTRY_URL_KEY) ? System.getenv(REGISTRY_URL_KEY)
            : "git.project-hobbit.eu:4567";
    if ((username != null) && (password != null)) {
        gitlabAuth = RegistryAuth.builder().serverAddress(registryUrl).username(username).password(password)
                .email(email).build();
    } else {
        LOGGER.warn(
                "Couldn't load a username ({}), email ({}) and a security token ({}) to access private repositories. This platform won't be able to pull protected or private images.",
                USER_NAME_KEY, USER_EMAIL_KEY, USER_PASSWORD_KEY);
        gitlabAuth = null;
    }
    gelfAddress = System.getenv(LOGGING_GELF_ADDRESS_KEY);
    if (gelfAddress == null) {
        LOGGER.info(
                "Didn't find a gelf address ({}). Containers created by this platform will use the default logging.",
                LOGGING_GELF_ADDRESS_KEY);
    }
    // try to find hobbit network in existing ones
    List<Network> networks = dockerClient.listNetworks();
    String hobbitNetwork = null;
    for (Network net : networks) {
        if (net.name().equals(HOBBIT_DOCKER_NETWORK)) {
            hobbitNetwork = net.id();
            break;
        }
    }
    // if not found - create new one
    if (hobbitNetwork == null) {
        final NetworkConfig networkConfig = NetworkConfig.builder().name(HOBBIT_DOCKER_NETWORK).build();
        dockerClient.createNetwork(networkConfig);
    }
}
 
開發者ID:hobbit-project,項目名稱:platform,代碼行數:46,代碼來源:ContainerManagerImpl.java


注:本文中的com.spotify.docker.client.messages.NetworkConfig類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。