Skip to content

Commit 9f82f59

Browse files
authored
Accept hashicorp/vault image (#6796)
Currently, `VaultContainer` accepts `vault` from Docker Official Image. But, there is a deprecation notice and recommend to use `hashicorp/vault` instead. In order to keep backward compatibility, both `vault` and `hashicorp/vault` are valid images.
1 parent c418598 commit 9f82f59

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

modules/vault/src/main/java/org/testcontainers/vault/VaultContainer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
*/
2525
public class VaultContainer<SELF extends VaultContainer<SELF>> extends GenericContainer<SELF> {
2626

27-
private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("vault");
27+
private static final DockerImageName DEFAULT_OLD_IMAGE_NAME = DockerImageName.parse("vault");
28+
29+
private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("hashicorp/vault");
2830

2931
private static final String DEFAULT_TAG = "1.1.3";
3032

@@ -50,7 +52,7 @@ public VaultContainer(String dockerImageName) {
5052

5153
public VaultContainer(final DockerImageName dockerImageName) {
5254
super(dockerImageName);
53-
dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME);
55+
dockerImageName.assertCompatibleWith(DEFAULT_OLD_IMAGE_NAME, DEFAULT_IMAGE_NAME);
5456

5557
// Use the vault healthcheck endpoint to check for readiness, per https://www.vaultproject.io/api/system/health.html
5658
setWaitStrategy(Wait.forHttp("/v1/sys/health").forStatusCode(200));

modules/vault/src/test/java/org/testcontainers/vault/VaultContainerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class VaultContainerTest {
2424

2525
@ClassRule
2626
// vaultContainer {
27-
public static VaultContainer<?> vaultContainer = new VaultContainer<>("vault:1.6.1")
27+
public static VaultContainer<?> vaultContainer = new VaultContainer<>("hashicorp/vault:1.13")
2828
.withVaultToken(VAULT_TOKEN)
2929
.withSecretInVault("secret/testing1", "top_secret=password123")
3030
.withSecretInVault(

0 commit comments

Comments
 (0)