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

SDK-339: Fix auto Docker setup in Sdk #297

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
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 @@ -11,12 +11,14 @@
import com.github.dockerjava.api.model.PullResponseItem;
import com.github.dockerjava.api.model.Volume;
import org.apache.commons.lang.StringUtils;
import com.github.dockerjava.api.command.ListImagesCmd;
import org.apache.maven.plugin.MojoExecutionException;

import java.io.Closeable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Collections;
import java.util.concurrent.CountDownLatch;

/**
Expand Down Expand Up @@ -62,8 +64,10 @@ public void executeTask() throws MojoExecutionException {
}

private boolean noMySqlImage(DockerClient docker) {
List<Image> mysql = docker.listImagesCmd().withImageNameFilter(MYSQL_8_4_1).exec();
return mysql.size() == 0;
ListImagesCmd listImagesCmd = docker.listImagesCmd();
listImagesCmd.getFilters().put("reference", Collections.singletonList(MYSQL_8_4_1));
List<Image> mysql = listImagesCmd.exec();
return mysql.isEmpty();
}

private void createMysqlContainer(DockerClient docker) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ private String determineDefaultDockerHost() {

private String determineWindowsDockerHost() {
if (determineDockerForWindowsHost()) {
return DockerHelper.DEFAULT_HOST_DOCKER_FOR_WINDOWS;
return DockerHelper.DEFAULT_WINDOWS_PIPE_FOR_DOCKER;
} else {
return determineDockerToolboxHost();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class DockerHelper {
private static final String DOCKER_HOST_KEY = "dockerHost";
public static final String DEFAULT_DOCKER_HOST_UNIX_SOCKET = "unix:///var/run/docker.sock";
public static final String DEFAULT_HOST_DOCKER_FOR_WINDOWS = "http://127.0.0.1:2375/";
public static final String DEFAULT_WINDOWS_PIPE_FOR_DOCKER = "npipe:////./pipe/docker_engine";

private static final String DOCKER_HOST_MSG_WINDOWS = "To use dockerized MySQL, You have to pass Docker Host URL to SDK. " +
"You should run SDK from docker-machine command line, so SDK can connect to your Docker. Your individual docker host URL can be obtained by calling command" +
Expand Down
Loading