本文整理匯總了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);
}
示例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);
}
}