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