Skip to content

Commit 959985b

Browse files
committed
setup docker
1 parent a2af7f4 commit 959985b

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

.nx/workflows/agents.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ launch-templates:
22
linux-extra-large-plus-jvm:
33
env:
44
NX_CLOUD_FORCE_USE_EXECUTE_TASKS_V3: "false"
5-
DOCKER_HOST: ""
65
SERVICES_HOST: ""
76
LANG: C.UTF-8
87
resource-class: 'docker_linux_amd64/extra_large+'
@@ -20,6 +19,7 @@ launch-templates:
2019
sudo apt install -y openjdk-21-jdk
2120
sudo update-alternatives --set java /usr/lib/jvm/java-21-openjdk-amd64/bin/java
2221
java -version
22+
2323
- name: Setup gradle
2424
script: ./gradlew wrapper && ./gradlew --stop && ./gradlew clean
2525

spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/core/DefaultDockerCompose.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ class DefaultDockerCompose implements DockerCompose {
4646
this.hostname = DockerHost.get(host, () -> cli.run(new DockerCliCommand.Context()));
4747
}
4848

49+
DefaultDockerCompose(DockerCli cli, String host, java.util.function.Function<String, String> systemEnv) {
50+
this.cli = cli;
51+
this.hostname = DockerHost.get(host, systemEnv, () -> cli.run(new DockerCliCommand.Context()));
52+
}
53+
4954
@Override
5055
public void up(LogLevel logLevel) {
5156
up(logLevel, Collections.emptyList());

spring-boot-project/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/core/DefaultDockerComposeTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void getRunningServicesWhenNoHostUsesHostFromContext() {
134134
.run(new DockerCliCommand.Context());
135135
willReturn(List.of(psResponse)).given(this.cli).run(new DockerCliCommand.ComposePs());
136136
willReturn(List.of(inspectResponse)).given(this.cli).run(new DockerCliCommand.Inspect(List.of(id)));
137-
DefaultDockerCompose compose = new DefaultDockerCompose(this.cli, null);
137+
DefaultDockerCompose compose = new DefaultDockerCompose(this.cli, null, (key) -> null);
138138
List<RunningService> runningServices = compose.getRunningServices();
139139
assertThat(runningServices).hasSize(1);
140140
RunningService runningService = runningServices.get(0);

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/configuration/ResolvedDockerHost.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,29 @@ public String getAddress() {
6464
}
6565

6666
public boolean isRemote() {
67-
return getAddress().startsWith("http") || getAddress().startsWith("tcp");
67+
String originalAddress = super.getAddress();
68+
if (originalAddress == null) {
69+
originalAddress = getDefaultAddress();
70+
}
71+
// If it starts with unix://, it's definitely local
72+
if (originalAddress.startsWith(UNIX_SOCKET_PREFIX)) {
73+
return false;
74+
}
75+
// Check the processed address for http/tcp
76+
String processedAddress = getAddress();
77+
if (processedAddress.startsWith("http") || processedAddress.startsWith("tcp")) {
78+
// Check if it's localhost or 127.0.0.1 - these are local even over TCP
79+
if (processedAddress.contains("localhost") || processedAddress.contains("127.0.0.1")) {
80+
return false;
81+
}
82+
return true;
83+
}
84+
// If it's not http/tcp and it's a local file reference, it's local
85+
if (isLocalFileReference()) {
86+
return false;
87+
}
88+
// Default to remote for anything else
89+
return false;
6890
}
6991

7092
public boolean isLocalFileReference() {

0 commit comments

Comments
 (0)