Skip to content

Commit

Permalink
docker -fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kb019 committed Sep 30, 2024
1 parent 7e10aaf commit 4538e2b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
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.Arrays;
import java.util.concurrent.CountDownLatch;

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,8 @@ public String determineDbName(String uri, String serverId) throws MojoExecutionE
}

dbName = dbName.substring(1);

if (!dbName.substring(1).matches("^[A-Za-z0-9_\\-]+$")) {
if (!dbName.substring(1).matches("^[A-Za-z0-9_\\-]+$")) {
throw new MojoExecutionException(
"The database name is not in the correct format (it should only have alphanumeric, dash and underscore signs): "
+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class DockerHelper {
public static final String DOCKER_MYSQL_PASSWORD = "Admin123";
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_HOST_DOCKER_FOR_WINDOWS = "tcp://127.0.0.1:2375/";

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

0 comments on commit 4538e2b

Please sign in to comment.