Course – Black Friday 2025 – NPI EA (cat= Baeldung)
announcement - icon

Yes, we're now running our Black Friday Sale. All Access and Pro are 33% off until 2nd December, 2025:

>> EXPLORE ACCESS NOW

Partner – Orkes – NPI EA (cat=Spring)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

Partner – Orkes – NPI EA (tag=Microservices)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

eBook – Guide Spring Cloud – NPI EA (cat=Spring Cloud)
announcement - icon

Let's get started with a Microservice Architecture with Spring Cloud:

>> Join Pro and download the eBook

eBook – Mockito – NPI EA (tag = Mockito)
announcement - icon

Mocking is an essential part of unit testing, and the Mockito library makes it easy to write clean and intuitive unit tests for your Java code.

Get started with mocking and improve your application tests using our Mockito guide:

Download the eBook

eBook – Reactive – NPI EA (cat=Reactive)
announcement - icon

Spring 5 added support for reactive programming with the Spring WebFlux module, which has been improved upon ever since. Get started with the Reactor project basics and reactive programming in Spring Boot:

>> Join Pro and download the eBook

eBook – Java Streams – NPI EA (cat=Java Streams)
announcement - icon

Since its introduction in Java 8, the Stream API has become a staple of Java development. The basic operations like iterating, filtering, mapping sequences of elements are deceptively simple to use.

But these can also be overused and fall into some common pitfalls.

To get a better understanding on how Streams work and how to combine them with other language features, check out our guide to Java Streams:

>> Join Pro and download the eBook

eBook – Jackson – NPI EA (cat=Jackson)
announcement - icon

Do JSON right with Jackson

Download the E-book

eBook – HTTP Client – NPI EA (cat=Http Client-Side)
announcement - icon

Get the most out of the Apache HTTP Client

Download the E-book

eBook – Maven – NPI EA (cat = Maven)
announcement - icon

Get Started with Apache Maven:

Download the E-book

eBook – Persistence – NPI EA (cat=Persistence)
announcement - icon

Working on getting your persistence layer right with Spring?

Explore the eBook

eBook – RwS – NPI EA (cat=Spring MVC)
announcement - icon

Building a REST API with Spring?

Download the E-book

Course – LS – NPI EA (cat=Jackson)
announcement - icon

Get started with Spring and Spring Boot, through the Learn Spring course:

>> LEARN SPRING
Course – RWSB – NPI EA (cat=REST)
announcement - icon

Explore Spring Boot 3 and Spring 6 in-depth through building a full REST API with the framework:

>> The New “REST With Spring Boot”

Course – LSS – NPI EA (cat=Spring Security)
announcement - icon

Yes, Spring Security can be complex, from the more advanced functionality within the Core to the deep OAuth support in the framework.

I built the security material as two full courses - Core and OAuth, to get practical with these more complex scenarios. We explore when and how to use each feature and code through it on the backing project.

You can explore the course here:

>> Learn Spring Security

Partner – Orkes – NPI EA (cat=Java)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

Course – LSD – NPI EA (tag=Spring Data JPA)
announcement - icon

Spring Data JPA is a great way to handle the complexity of JPA with the powerful simplicity of Spring Boot.

Get started with Spring Data JPA through the guided reference course:

>> CHECK OUT THE COURSE

Partner – Moderne – NPI EA (cat=Spring Boot)
announcement - icon

Refactor Java code safely — and automatically — with OpenRewrite.

Refactoring big codebases by hand is slow, risky, and easy to put off. That’s where OpenRewrite comes in. The open-source framework for large-scale, automated code transformations helps teams modernize safely and consistently.

Each month, the creators and maintainers of OpenRewrite at Moderne run live, hands-on training sessions — one for newcomers and one for experienced users. You’ll see how recipes work, how to apply them across projects, and how to modernize code with confidence.

Join the next session, bring your questions, and learn how to automate the kind of work that usually eats your sprint time.

Course – Black Friday 2025 – NPI (cat=Baeldung)
announcement - icon

Yes, we're now running our Black Friday Sale. All Access and Pro are 33% off until 2nd December, 2025:

>> EXPLORE ACCESS NOW

Partner – LambdaTest – NPI (cat= Testing)
announcement - icon

Regression testing is an important step in the release process, to ensure that new code doesn't break the existing functionality. As the codebase evolves, we want to run these tests frequently to help catch any issues early on.

The best way to ensure these tests run frequently on an automated basis is, of course, to include them in the CI/CD pipeline. This way, the regression tests will execute automatically whenever we commit code to the repository.

In this tutorial, we'll see how to create regression tests using Selenium, and then include them in our pipeline using GitHub Actions:, to be run on the LambdaTest cloud grid:

>> How to Run Selenium Regression Tests With GitHub Actions

1. Overview

In recent years, Testcontainers has become a go-to library for Java integration testing, enabling us to spin up real containers during our test lifecycle. Such containers represent external dependencies, such as databases, message brokers, and other components. The official library page describes it as “an open source library for providing throwaway, lightweight instances…that run in a Docker container.”

At the same time, many teams are exploring or migrating to alternative container solutions. Podman is one of those alternatives, if not the most common. The reason for that is licensing changes or a preference for rootless engines. So the natural question arises: Can we use Podman instead of Docker for Testcontainers in a Java project?

In this tutorial, we’ll walk through how to get Testcontainers working with Podman, outline what’s officially supported, show the required configuration, and highlight pitfalls.

2. Why Consider Using Podman Instead of Docker?

As mentioned, Docker has made a few changes to its licensing in the past, but here are a few more reasons:

  • On Linux, Podman offers a daemonless, rootless container engine that can be simpler and more secure in some environments
  • In CI/CD environments (especially on Linux), running Podman can align with existing infrastructure and reduce reliance on the Docker Engine
  •  Teams using Apple Silicon Macs may prefer Podman’s podman machine mode over Docker Desktop

That said, for the Testcontainers-based tests, we need a Docker API-compatible container runtime, as the maintainer states that container runtimes are not actively tested in the main development workflow.

3. Configuring Podman for Testcontainers

Let’s walk through the steps required to configure Podman so that Testcontainers can use it as a container runtime. The setup presented in this article was tested only on Linux and Mac machines. It may be possible to use the WSL2 Linux distribution for Windows, but it has not been tested.

3.1. Installing Podman

First, let’s install Podman on our local environments following the instructions on the official page. This will enable us to run a container with the Podman container engine.

3.2. Enabling the Podman Socket

Testcontainers needs to communicate with the container engine through a socket that implements the Docker API.

On Linux, we can enable the socket for our users like this:

systemctl --user enable --now podman.socket

Then, we can confirm that the socket is active:

ls -la /run/user/$UID/podman/podman.sock

On Mac, the socket is available inside the Podman VM. We can check its path using:

podman machine start
podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}'

The last command prints the full path to the Podman Docker API socket on your Mac host. We will use that path in the next section to configure DOCKER_HOST.

3.3. Setting the Environment Variables

Next, we need to instruct Testcontainers on how to connect to the Podman socket. This can be done by setting the DOCKER_HOST environment variable.

On Linux:

export DOCKER_HOST=unix://${XDG_RUNTIME_DIR}/podman/podman.sock
export TESTCONTAINERS_RYUK_DISABLED=true

On macOS:

export DOCKER_HOST=unix://$(podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}')
export TESTCONTAINERS_RYUK_DISABLED=true

By default, Docker setups use Testcontainers’ helper container, “Ryuk,” to automatically clean up resources (containers and networks). With Podman support, this may not always work (especially in rootless mode or macOS VM scenarios). The workaround is to turn it off using TESTCONTAINERS_RYUK_DISABLED=true.

4. Known Limitations & Caveats

It’s important to highlight the things that may still cause friction when running Testcontainers with Podman:

Feature gaps The official statement is that alternative container runtimes are not actively tested by the Testcontainers team, so “not all features might be available.”
Ryuk channel issues As mentioned, container cleanup via Ryuk may fail or require privileged mode or disabling. That means potential leftover containers, networks, and volumes, if cleanup is not handled.
Socket/permissions issues In rootless mode, Podman listens on unix:///run/user/$UID/podman/podman.sock. Our test environment must have permissions to that socket; on MacOS, the VM and host mapping might cause path mismatches.
Host networking & mapping quirks Because Podman uses a different default network mode (for instance, sometimes podman network instead of Docker’s bridge), specific advanced networking configurations (custom networks, aliasing, host port binding) may not work identically to Docker
Image pull/short‐name lookup On some distributions, Podman may prompt for a registry when using short image names (e.g., busybox) unless unqualified-search-registries is configured. If Testcontainers pulls and encounters a prompt, tests may hang.
CI/agent environment variability If we build agents that vary (some use Docker, some Podman), we may introduce subtle differences. We must test both paths.
Compatibility with third-party extensions If you rely on frameworks (for instance, Quarkus Dev Services) that assume Docker, their Podman support may be less mature.

In short, yes, we can use Testcontainers with Podman for Java tests, as long as we configure the socket and environment variables and consider the cleanup strategy. So it’s not plug-and-play. We need to test the configuration path early (especially on Mac or ARM) and monitor for leftover containers, socket permissions issues, or feature mismatches.

5. Testing Setup

With the environment configured, we can write integration tests just as we do with Docker. For example:

@Test
void whenSettingValue_thenCanGetItBack() {
    try (RedisContainer redis = new RedisContainer("redis:7-alpine").withExposedPorts(6379)) {
        redis.start();

        String host = redis.getHost();
        int port = redis.getFirstMappedPort();

        try (Jedis jedis = new Jedis(host, port)) {
            jedis.set("greeting", "hello");
            String value = jedis.get("greeting");
            Assertions.assertEquals("hello", value);
        }
    }
}

This test is a simple integration test using a Redis container, where the test only sets a value and retrieves it using the Jedis APIs. This is a straightforward test, but it is enough to confirm our Podman setup.

Next, let’s also use another very common database, which is frequently used on Java projects.

@Test
void whenQueryingDatabase_thenReturnsOne() throws Exception {

    try (MySQLContainer mysql = new MySQLContainer("mysql:8.4")) {
        mysql.start();

        try (Connection conn = DriverManager
          .getConnection(mysql.getJdbcUrl(), mysql.getUsername(), mysql.getPassword());
             Statement st = conn.createStatement()) {

            st.execute("CREATE TABLE t(id INT PRIMARY KEY)");
            st.execute("INSERT INTO t VALUES (1)");
            ResultSet rs = st.executeQuery("SELECT COUNT(*) FROM t");
            rs.next();
            Assertions.assertEquals(1, rs.getInt(1));
        }
    }
}

Finally, let’s use a message broker with a setup a bit more complicated but still using a single container.

@Test
void whenProducingMessage_thenConsumerReceivesIt() {
    DockerImageName image = DockerImageName.parse("confluentinc/cp-kafka:7.6.1");
    try (KafkaContainer kafka = new KafkaContainer(image)) {
        kafka.start();

        String bootstrap = kafka.getBootstrapServers();
        String topic = "hello";

        Properties prodProps = new Properties();
        prodProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrap);
        prodProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
        prodProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());

        try (KafkaProducer<String, String> producer = new KafkaProducer<>(prodProps)) {
            producer.send(new ProducerRecord<>(topic, "key", "hello")).get();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        Properties consProps = new Properties();
        consProps.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrap);
        consProps.put(ConsumerConfig.GROUP_ID_CONFIG, "test-group");
        consProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
        consProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
        consProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());

        try (KafkaConsumer<String, String> consumer = new KafkaConsumer<>(consProps)) {
            consumer.subscribe(Collections.singletonList(topic));
            ConsumerRecords<String, String> records = consumer.poll(Duration.ofSeconds(10));
            ConsumerRecord<String, String> first = records.iterator().next();
            Assertions.assertEquals("hello", first.value());
        }
    }
}

Using these integration tests, we can confirm the container’s compatibility, verify that our Podman setup is functional, and enable us to utilize a new runtime engine.

6. Conclusion

In this article, we provide a clear path to adopting Podman with Testcontainers in our Java projects and help us avoid the common pitfalls many developers encounter.

Switching the container runtime from Docker to Podman for Testcontainers in Java isn’t just about replacing an alias. It requires awareness of socket configuration, cleanup mechanisms, permissions, and underlying differences. But with the correct setup, we can be confident our integration tests run reliably, regardless of the container engine.

Course – Black Friday 2025 – NPI EA (cat= Baeldung)
announcement - icon

Yes, we're now running our Black Friday Sale. All Access and Pro are 33% off until 2nd December, 2025:

>> EXPLORE ACCESS NOW

Partner – Orkes – NPI EA (cat = Spring)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

Partner – Orkes – NPI EA (tag = Microservices)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

eBook – HTTP Client – NPI EA (cat=HTTP Client-Side)
announcement - icon

The Apache HTTP Client is a very robust library, suitable for both simple and advanced use cases when testing HTTP endpoints. Check out our guide covering basic request and response handling, as well as security, cookies, timeouts, and more:

>> Download the eBook

eBook – Java Concurrency – NPI EA (cat=Java Concurrency)
announcement - icon

Handling concurrency in an application can be a tricky process with many potential pitfalls. A solid grasp of the fundamentals will go a long way to help minimize these issues.

Get started with understanding multi-threaded applications with our Java Concurrency guide:

>> Download the eBook

eBook – Java Streams – NPI EA (cat=Java Streams)
announcement - icon

Since its introduction in Java 8, the Stream API has become a staple of Java development. The basic operations like iterating, filtering, mapping sequences of elements are deceptively simple to use.

But these can also be overused and fall into some common pitfalls.

To get a better understanding on how Streams work and how to combine them with other language features, check out our guide to Java Streams:

>> Join Pro and download the eBook

eBook – Persistence – NPI EA (cat=Persistence)
announcement - icon

Working on getting your persistence layer right with Spring?

Explore the eBook

Course – LS – NPI EA (cat=REST)

announcement - icon

Get started with Spring Boot and with core Spring, through the Learn Spring course:

>> CHECK OUT THE COURSE

Partner – Moderne – NPI EA (tag=Refactoring)
announcement - icon

Modern Java teams move fast — but codebases don’t always keep up. Frameworks change, dependencies drift, and tech debt builds until it starts to drag on delivery. OpenRewrite was built to fix that: an open-source refactoring engine that automates repetitive code changes while keeping developer intent intact.

The monthly training series, led by the creators and maintainers of OpenRewrite at Moderne, walks through real-world migrations and modernization patterns. Whether you’re new to recipes or ready to write your own, you’ll learn practical ways to refactor safely and at scale.

If you’ve ever wished refactoring felt as natural — and as fast — as writing code, this is a good place to start.

Course – Black Friday 2025 – NPI (All)
announcement - icon

Yes, we're now running our Black Friday Sale. All Access and Pro are 33% off until 2nd December, 2025:

>> EXPLORE ACCESS NOW

eBook Jackson – NPI EA – 3 (cat = Jackson)
guest
0 Comments
Oldest
Newest
Inline Feedbacks
View all comments