Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rely on TransportConfig to read DOCKER_HOST env variable for DockerComposeContainer #5276

Merged
merged 1 commit into from
Apr 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -726,20 +726,17 @@ public void invoke() {
final Map<String, String> environment = Maps.newHashMap(env);
environment.put(ENV_PROJECT_NAME, identifier);

String dockerHost = System.getenv("DOCKER_HOST");
if (dockerHost == null) {
TransportConfig transportConfig = DockerClientFactory.instance().getTransportConfig();
SSLConfig sslConfig = transportConfig.getSslConfig();
if (sslConfig != null) {
if (sslConfig instanceof LocalDirectorySSLConfig) {
environment.put("DOCKER_CERT_PATH", ((LocalDirectorySSLConfig) sslConfig).getDockerCertPath());
environment.put("DOCKER_TLS_VERIFY", "true");
} else {
logger().warn("Couldn't set DOCKER_CERT_PATH. `sslConfig` is present but it's not LocalDirectorySSLConfig.");
}
TransportConfig transportConfig = DockerClientFactory.instance().getTransportConfig();
SSLConfig sslConfig = transportConfig.getSslConfig();
if (sslConfig != null) {
if (sslConfig instanceof LocalDirectorySSLConfig) {
environment.put("DOCKER_CERT_PATH", ((LocalDirectorySSLConfig) sslConfig).getDockerCertPath());
environment.put("DOCKER_TLS_VERIFY", "true");
} else {
logger().warn("Couldn't set DOCKER_CERT_PATH. `sslConfig` is present but it's not LocalDirectorySSLConfig.");
}
dockerHost = transportConfig.getDockerHost().toString();
}
String dockerHost = transportConfig.getDockerHost().toString();
environment.put("DOCKER_HOST", dockerHost);

final Stream<String> absoluteDockerComposeFilePaths = composeFiles.stream()
Expand Down