Could not find a valid Docker environment

Client:
Version: 29.2.1
Context: default
Debug Mode: false
Plugins:
ai: Docker AI Agent - Ask Gordon (Docker Inc.)
Version: v1.18.0
Path: C:\Program Files\Docker\cli-plugins\docker-ai.exe
buildx: Docker Buildx (Docker Inc.)
Version: v0.31.1-desktop.1
Path: C:\Program Files\Docker\cli-plugins\docker-buildx.exe
compose: Docker Compose (Docker Inc.)
Version: v5.0.2
Path: C:\Program Files\Docker\cli-plugins\docker-compose.exe
debug: Get a shell into any image or container (Docker Inc.)
Version: 0.0.47
Path: C:\Program Files\Docker\cli-plugins\docker-debug.exe
desktop: Docker Desktop commands (Docker Inc.)
Version: v0.3.0
Path: C:\Program Files\Docker\cli-plugins\docker-desktop.exe
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.31
Path: C:\Program Files\Docker\cli-plugins\docker-extension.exe
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.4.0
Path: C:\Program Files\Docker\cli-plugins\docker-init.exe
mcp: Docker MCP Plugin (Docker Inc.)
Version: v0.40.0
Path: C:\Program Files\Docker\cli-plugins\docker-mcp.exe
model: Docker Model Runner (Docker Inc.)
Version: v1.0.12
Path: C:\Program Files\Docker\cli-plugins\docker-model.exe
offload: Docker Offload (Docker Inc.)
Version: v0.5.52
Path: C:\Program Files\Docker\cli-plugins\docker-offload.exe
pass: Docker Pass Secrets Manager Plugin (beta) (Docker Inc.)
Version: v0.0.24
Path: C:\Program Files\Docker\cli-plugins\docker-pass.exe
sandbox: Docker Sandbox (Docker Inc.)
Version: v0.12.0
Path: C:\Program Files\Docker\cli-plugins\docker-sandbox.exe
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: C:\Program Files\Docker\cli-plugins\docker-sbom.exe
scout: Docker Scout (Docker Inc.)
Version: v1.19.0
Path: C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 1
Server Version: 29.2.1
Storage Driver: overlayfs
driver-type: io.containerd.snapshotter.v1
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
CDI spec directories:
/etc/cdi
/var/run/cdi
Discovered Devices:
cdi: docker.com/gpu=webgpu
Swarm: inactive
Runtimes: io.containerd.runc.v2 nvidia runc
Default Runtime: runc
Init Binary: docker-init
containerd version: dea7da592f5d1d2b7755e3a161be07f43fad8f75
runc version: v1.3.4-0-gd6d73eb8
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.6.87.2-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 8.701GiB
Name: docker-desktop
ID: e1ebe255-3aca-414e-b77c-6c4029f97087
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Labels:
com.docker.desktop.address=npipe://\.\pipe\docker_cli
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
::1/128
127.0.0.0/8
Live Restore Enabled: false
Firewall Backend: iptables

this is my configuration

4.0.0

org.springframework.boot
spring-boot-starter-parent
3.3.2

com.codingshuttle
TestingApp
0.0.1-SNAPSHOT
TestingApp
Demo project for Spring Boot

<java.version>22</java.version>
<dependencies>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-web</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-data-jpa</artifactId>
	</dependency>
	<dependency>
		<groupId>org.postgresql</groupId>
		<artifactId>postgresql</artifactId>
		<scope>runtime</scope>
	</dependency>
	<dependency>
		<groupId>org.projectlombok</groupId>
		<artifactId>lombok</artifactId>
		<optional>true</optional>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-test</artifactId>
		<scope>test</scope>
	</dependency>
	<dependency>
		<groupId>org.modelmapper</groupId>
		<artifactId>modelmapper</artifactId>
		<version>3.2.0</version>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-testcontainers</artifactId>
		<scope>test</scope>
	</dependency>
    <dependency>
        <groupId>org.testcontainers</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>1.21.4</version>
        <scope>test</scope>
    </dependency>
	<dependency>
		<groupId>org.testcontainers</groupId>
		<artifactId>postgresql</artifactId>
		<scope>test</scope>
	</dependency>
    <!-- Source: https://mvnrepository.com/artifact/com.h2database/h2 -->
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>test</scope>
    </dependency>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>testcontainers-bom</artifactId>
                <version>1.20.4</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>


        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
        </dependency>

</dependencies>

<build>
	<plugins>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
		</plugin>
	</plugins>
</build>

this is my pom.xml

package com.codingshuttle.TestingApp.repositories;

import com.codingshuttle.TestingApp.TestcontainerConfiguration;
import com.codingshuttle.TestingApp.entities.Employee;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import org.testcontainers.junit.jupiter.Testcontainers;

import java.util.List;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.junit.jupiter.api.Assertions.*;

//[@SpringBootTest](https://github.com/SpringBootTest)
[@slf4j](https://github.com/slf4j)
//[@testcontainers](https://github.com/testcontainers)
[@DataJpaTest](https://github.com/DataJpaTest)
[@import](https://github.com/import)(TestcontainerConfiguration.class)
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
class EmployeeRepositoryTest {


@Autowired
private EmployeeRepository employeeRepository;

Employee employee;

@BeforeEach
void createEmployee(){
     employee = com.codingshuttle.TestingApp.entities.Employee.builder().email("vedant@gmail.com").name("vedant").salary(100l).build();
}

@Test
void testfindByEmail_whenEmailIsValid_thenReturnEmployee() {
    //Arrange,Given
    employeeRepository.save(employee);
    //Act,When
    List<Employee> employeeList = employeeRepository.findByEmail(employee.getEmail());
    //Assert,Then
    assertThat(employeeList).isNotNull();
    assertThat(employeeList.get(0).getEmail()).isEqualTo(employee.getEmail()) ;
}

@Test
void testfindByEmail_whenEmailIsNotFound_thenReturnEmptyEmployeeList(){
    log.info("email of employee {}",employee.getEmail());
    List<Employee> employeeList = employeeRepository.findByEmail(employee.getEmail());
    assertThat(employeeList).isNotNull();

  //  assertThat(employeeList.get(0).getEmail()).isEqualTo("vedantnotemail") ;
}

}

this is my code
still getting error

2026-03-24T22:29:20.892+05:30 ERROR 23768 --- [TestingApp] [ main] o.t.d.DockerClientProviderStrategy : Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
EnvironmentAndSystemPropertyClientProviderStrategy: failed with exception BadRequestException (Status 400: {"ID":"","Containers":0,"ContainersRunning":0,"ContainersPaused":0,"ContainersStopped":0,"Images":0,"Driver":"","DriverStatus":null,"Plugins":{"Volume":null,"Network":null,"Authorization":null,"Log":null},"MemoryLimit":false,"SwapLimit":false,"CpuCfsPeriod":false,"CpuCfsQuota":false,"CPUShares":false,"CPUSet":false,"PidsLimit":false,"IPv4Forwarding":false,"Debug":false,"NFd":0,"OomKillDisable":false,"NGoroutines":0,"SystemTime":"","LoggingDriver":"","CgroupDriver":"","NEventsListener":0,"KernelVersion":"","OperatingSystem":"","OSVersion":"","OSType":"","Architecture":"","IndexServerAddress":"","RegistryConfig":null,"NCPU":0,"MemTotal":0,"GenericResources":null,"DockerRootDir":"","HttpProxy":"","HttpsProxy":"","NoProxy":"","Name":"","Labels":["com.docker.desktop.address=npipe://\\.\pipe\docker_cli"],"ExperimentalBuild":false,"ServerVersion":"","Runtimes":null,"DefaultRuntime":"","Swarm":{"NodeID":"","NodeAddr":"","LocalNodeState":"","ControlAvailable":false,"Error":"","RemoteManagers":null},"LiveRestoreEnabled":false,"Isolation":"","InitBinary":"","ContainerdCommit":{"ID":""},"RuncCommit":{"ID":""},"InitCommit":{"ID":""},"SecurityOptions":null,"CDISpecDirs":null,"Warnings":null})
NpipeSocketClientProviderStrategy: failed with exception BadRequestException (Status 400: {"ID":"","Containers":0,"ContainersRunning":0,"ContainersPaused":0,"ContainersStopped":0,"Images":0,"Driver":"","DriverStatus":null,"Plugins":{"Volume":null,"Network":null,"Authorization":null,"Log":null},"MemoryLimit":false,"SwapLimit":false,"CpuCfsPeriod":false,"CpuCfsQuota":false,"CPUShares":false,"CPUSet":false,"PidsLimit":false,"IPv4Forwarding":false,"Debug":false,"NFd":0,"OomKillDisable":false,"NGoroutines":0,"SystemTime":"","LoggingDriver":"","CgroupDriver":"","NEventsListener":0,"KernelVersion":"","OperatingSystem":"","OSVersion":"","OSType":"","Architecture":"","IndexServerAddress":"","RegistryConfig":null,"NCPU":0,"MemTotal":0,"GenericResources":null,"DockerRootDir":"","HttpProxy":"","HttpsProxy":"","NoProxy":"","Name":"","Labels":["com.docker.desktop.address=npipe://\\.\pipe\docker_cli"],"ExperimentalBuild":false,"ServerVersion":"","Runtimes":null,"DefaultRuntime":"","Swarm":{"NodeID":"","NodeAddr":"","LocalNodeState":"","ControlAvailable":false,"Error":"","RemoteManagers":null},"LiveRestoreEnabled":false,"Isolation":"","InitBinary":"","ContainerdCommit":{"ID":""},"RuncCommit":{"ID":""},"InitCommit":{"ID":""},"SecurityOptions":null,"CDISpecDirs":null,"Warnings":null})As no valid configuration was found, execution cannot continue.
See https://java.testcontainers.org/on_failure.html for more details.
2026-03-24T22:29:20.903+05:30 WARN 23768 --- [TestingApp] [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Failed to initialize dependency 'dataSourceScriptDatabaseInitializer' of LoadTimeWeaverAware bean 'entityManagerFactory': Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Unsatisfied dependency expressed through method 'dataSource' parameter 1: Error creating bean with name 'jdbcContainerConnectionDetailsForPostgresContainer': Error creating bean with name 'postgresContainer' defined in class path resource [com/codingshuttle/TestingApp/TestcontainerConfiguration.class]: Could not find a valid Docker environment. Please see logs and check configuration
2026-03-24T22:29:20.914+05:30 INFO 23768 --- [TestingApp]

You are running an older version of testcontainers, which is not compatible with docker v29, which your Docker Desktop version provides under the hood. If you want to stick with 1.x, you will need to use at least 1.21.4

Update: I will move the topic to the testcontainers category, as it’s a problem with using testcontainers.

Continuing the discussion from Could not find a valid Docker environment:

2026-03-27T22:34:37.910+05:30 ERROR 12856 — [TestingApp] [ main] o.t.d.DockerClientProviderStrategy : Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
EnvironmentAndSystemPropertyClientProviderStrategy: failed with exception BadRequestException (Status 400: {“ID”:“”,“Containers”:0,“ContainersRunning”:0,“ContainersPaused”:0,“ContainersStopped”:0,“Images”:0,“Driver”:“”,“DriverStatus”:null,“Plugins”:{“Volume”:null,“Network”:null,“Authorization”:null,“Log”:null},“MemoryLimit”:false,“SwapLimit”:false,“CpuCfsPeriod”:false,“CpuCfsQuota”:false,“CPUShares”:false,“CPUSet”:false,“PidsLimit”:false,“IPv4Forwarding”:false,“Debug”:false,“NFd”:0,“OomKillDisable”:false,“NGoroutines”:0,“SystemTime”:“”,“LoggingDriver”:“”,“CgroupDriver”:“”,“NEventsListener”:0,“KernelVersion”:“”,“OperatingSystem”:“”,“OSVersion”:“”,“OSType”:“”,“Architecture”:“”,“IndexServerAddress”:“”,“RegistryConfig”:null,“NCPU”:0,“MemTotal”:0,“GenericResources”:null,“DockerRootDir”:“”,“HttpProxy”:“”,“HttpsProxy”:“”,“NoProxy”:“”,“Name”:“”,“Labels”:[“com.docker.desktop.address=npipe://\\.\pipe\docker_cli”],“ExperimentalBuild”:false,“ServerVersion”:“”,“Runtimes”:null,“DefaultRuntime”:“”,“Swarm”:{“NodeID”:“”,“NodeAddr”:“”,“LocalNodeState”:“”,“ControlAvailable”:false,“Error”:“”,“RemoteManagers”:null},“LiveRestoreEnabled”:false,“Isolation”:“”,“InitBinary”:“”,“ContainerdCommit”:{“ID”:“”},“RuncCommit”:{“ID”:“”},“InitCommit”:{“ID”:“”},“SecurityOptions”:null,“CDISpecDirs”:null,“Warnings”:null})
NpipeSocketClientProviderStrategy: failed with exception BadRequestException (Status 400: {“ID”:“”,“Containers”:0,“ContainersRunning”:0,“ContainersPaused”:0,“ContainersStopped”:0,“Images”:0,“Driver”:“”,“DriverStatus”:null,“Plugins”:{“Volume”:null,“Network”:null,“Authorization”:null,“Log”:null},“MemoryLimit”:false,“SwapLimit”:false,“CpuCfsPeriod”:false,“CpuCfsQuota”:false,“CPUShares”:false,“CPUSet”:false,“PidsLimit”:false,“IPv4Forwarding”:false,“Debug”:false,“NFd”:0,“OomKillDisable”:false,“NGoroutines”:0,“SystemTime”:“”,“LoggingDriver”:“”,“CgroupDriver”:“”,“NEventsListener”:0,“KernelVersion”:“”,“OperatingSystem”:“”,“OSVersion”:“”,“OSType”:“”,“Architecture”:“”,“IndexServerAddress”:“”,“RegistryConfig”:null,“NCPU”:0,“MemTotal”:0,“GenericResources”:null,“DockerRootDir”:“”,“HttpProxy”:“”,“HttpsProxy”:“”,“NoProxy”:“”,“Name”:“”,“Labels”:[“com.docker.desktop.address=npipe://\\.\pipe\docker_cli”],“ExperimentalBuild”:false,“ServerVersion”:“”,“Runtimes”:null,“DefaultRuntime”:“”,“Swarm”:{“NodeID”:“”,“NodeAddr”:“”,“LocalNodeState”:“”,“ControlAvailable”:false,“Error”:“”,“RemoteManagers”:null},“LiveRestoreEnabled”:false,“Isolation”:“”,“InitBinary”:“”,“ContainerdCommit”:{“ID”:“”},“RuncCommit”:{“ID”:“”},“InitCommit”:{“ID”:“”},“SecurityOptions”:null,“CDISpecDirs”:null,“Warnings”:null})As no valid configuration was found, execution cannot continue.
See Fixing Issues with Discovering A Supported Container Runtime Environment - Testcontainers for Java for more details.

got this error still I changed my pom.xml

<?xml version="1.0" encoding="UTF-8"?>


4.0.0

org.springframework.boot
spring-boot-starter-parent
3.3.2


com.codingshuttle
TestingApp
0.0.1-SNAPSHOT
TestingApp
Demo project for Spring Boot














<java.version>22</java.version>

<dependencies>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-web</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-data-jpa</artifactId>
	</dependency>
	<dependency>
		<groupId>org.postgresql</groupId>
		<artifactId>postgresql</artifactId>
		<scope>runtime</scope>
	</dependency>
	<dependency>
		<groupId>org.projectlombok</groupId>
		<artifactId>lombok</artifactId>
		<optional>true</optional>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-test</artifactId>
		<scope>test</scope>
	</dependency>
	<dependency>
		<groupId>org.modelmapper</groupId>
		<artifactId>modelmapper</artifactId>
		<version>3.2.0</version>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-testcontainers</artifactId>
		<scope>test</scope>
	</dependency>
    <dependency>
        <groupId>org.testcontainers</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>1.21.4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.testcontainers</groupId>
        <artifactId>postgresql</artifactId>
        <version>1.21.4</version>
        <scope>test</scope>
    </dependency>

    <!-- Source: https://mvnrepository.com/artifact/com.h2database/h2 -->
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>test</scope>
    </dependency>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>testcontainers-bom</artifactId>
                <version>1.21.4</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-webflux</artifactId>
        <scope>test</scope>
    </dependency>


</dependencies>

<build>
	<plugins>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
		</plugin>
	</plugins>
</build>

this is updated as it uses 1.21.4 suggest things that I can provide you so I get it resolved

I moved the post from its new topic back here. I’m not sure why you created a new topic, but I assume it was done by accident.

Also please, format your post correctly using markdown, becaue it is really hard to know what is wrong when the shared code is not readable. Only part of your post is formatted similarly to what I edited in your first post, so it is best if you fix it as only you know how the shared code should look like.

Help for for formatting your code, logs and terminal output:

https://forums.docker.com/t/how-to-format-your-forum-posts/127295#p-202628-dockerfiles-compose-files-logs-and-code-4

Thanks for helping us to help you!