Replace container image name

MSAL

Replace a Docker image name in DockerImageName.parse(image) or new DockerImageName(image) constructor arguments for a specific container class.

org.openrewrite.java.testing.testcontainers.ReplaceContainerImageName

Required

The fully qualified name of the container class to match.

The Docker image prefix to match (e.g. confluentinc/cp-kafka).

The new Docker image to use. When a tag is included (e.g. apache/kafka-native:4.0.2), the entire image string is replaced. When no tag is included (e.g. clickhouse/clickhouse-server), only the image name prefix is replaced and the original tag is preserved.

mod run . --recipe=org.openrewrite.java.testing.testcontainers.ReplaceContainerImageName \ -P containerClass=org.testcontainers.containers.KafkaContainer \ -P imagePrefix=confluentinc/cp-kafka \ -P newImage=apache/kafka-native:4.0.2

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.