Skip to content

Commit 3c614f2

Browse files
authored
Upgrade alpine images for better M1 compatibility (#4291)
1 parent 71314ab commit 3c614f2

File tree

25 files changed

+42
-47
lines changed

25 files changed

+42
-47
lines changed

core/src/main/java/org/testcontainers/DockerClientFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class DockerClientFactory {
6464
TESTCONTAINERS_SESSION_ID_LABEL, SESSION_ID
6565
);
6666

67-
private static final DockerImageName TINY_IMAGE = DockerImageName.parse("alpine:3.5");
67+
private static final DockerImageName TINY_IMAGE = DockerImageName.parse("alpine:3.14");
6868
private static DockerClientFactory instance;
6969

7070
// Cached client configuration

core/src/test/java/org/testcontainers/TestImages.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public interface TestImages {
66
DockerImageName REDIS_IMAGE = DockerImageName.parse("redis:3.0.2");
77
DockerImageName RABBITMQ_IMAGE = DockerImageName.parse("rabbitmq:3.5.3");
88
DockerImageName MONGODB_IMAGE = DockerImageName.parse("mongo:3.1.5");
9-
DockerImageName ALPINE_IMAGE = DockerImageName.parse("alpine:3.2");
9+
DockerImageName ALPINE_IMAGE = DockerImageName.parse("alpine:3.14");
1010
DockerImageName DOCKER_REGISTRY_IMAGE = DockerImageName.parse("registry:2.7.0");
11-
DockerImageName TINY_IMAGE = DockerImageName.parse("alpine:3.5");
11+
DockerImageName TINY_IMAGE = DockerImageName.parse("alpine:3.14");
1212
}

core/src/test/java/org/testcontainers/containers/DockerComposeFilesTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ public void shouldGetDependencyImagesWhenOverriding() {
2020
Lists.newArrayList(new File("src/test/resources/docker-compose-imagename-overriding-a.yml"),
2121
new File("src/test/resources/docker-compose-imagename-overriding-b.yml")));
2222
Assertions.assertThat(dockerComposeFiles.getDependencyImages())
23-
.containsExactlyInAnyOrder("alpine:3.2", "redis:b", "mysql:b", "aservice");
23+
.containsExactlyInAnyOrder("alpine:3.14", "redis:b", "mysql:b", "aservice");
2424
}
2525
}

core/src/test/java/org/testcontainers/containers/ParsedDockerComposeFileValidationTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ public void shouldObtainImageFromDockerfileBuild() {
104104
.contains(
105105
entry("mysql", Sets.newHashSet("mysql")),
106106
entry("redis", Sets.newHashSet("redis")),
107-
entry("custom", Sets.newHashSet("alpine:3.2")))
108-
.as("all defined images are found"); // r/ redis, mysql from compose file, alpine:3.2 from Dockerfile build
107+
entry("custom", Sets.newHashSet("alpine:3.14")))
108+
.as("all defined images are found"); // r/ redis, mysql from compose file, alpine:3.14 from Dockerfile build
109109
}
110110

111111
@Test
@@ -116,7 +116,7 @@ public void shouldObtainImageFromDockerfileBuildWithContext() {
116116
.contains(
117117
entry("mysql", Sets.newHashSet("mysql")),
118118
entry("redis", Sets.newHashSet("redis")),
119-
entry("custom", Sets.newHashSet("alpine:3.2")))
120-
.as("all defined images are found"); // redis, mysql from compose file, alpine:3.2 from Dockerfile build
119+
entry("custom", Sets.newHashSet("alpine:3.14")))
120+
.as("all defined images are found"); // redis, mysql from compose file, alpine:3.14 from Dockerfile build
121121
}
122122
}

core/src/test/java/org/testcontainers/containers/output/ToStringConsumerTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class ToStringConsumerTest {
2424

2525
@Test
2626
public void newlines_are_not_added_to_exec_output() throws Exception {
27-
try (GenericContainer<?> container = new GenericContainer<>("alpine:3.13")) {
27+
try (GenericContainer<?> container = new GenericContainer<>("alpine:3.14")) {
2828
container.withCommand("sleep", "2m");
2929
container.start();
3030

@@ -37,7 +37,7 @@ public void newlines_are_not_added_to_exec_output() throws Exception {
3737

3838
@Test(timeout = 60_000L)
3939
public void newlines_are_not_added_to_exec_output_with_tty() throws Exception {
40-
try (GenericContainer<?> container = new GenericContainer<>("alpine:3.13")) {
40+
try (GenericContainer<?> container = new GenericContainer<>("alpine:3.14")) {
4141
container.withCreateContainerCmdModifier(cmd -> {
4242
cmd
4343
.withAttachStdin(true)
@@ -56,7 +56,7 @@ public void newlines_are_not_added_to_exec_output_with_tty() throws Exception {
5656

5757
@Test
5858
public void newlines_are_not_added_to_container_output() {
59-
try (GenericContainer<?> container = new GenericContainer<>("alpine:3.13")) {
59+
try (GenericContainer<?> container = new GenericContainer<>("alpine:3.14")) {
6060
container.withCommand("echo", "-n", LARGE_PAYLOAD);
6161
container.setStartupCheckStrategy(new OneShotStartupCheckStrategy());
6262
container.start();
@@ -71,7 +71,7 @@ public void newlines_are_not_added_to_container_output() {
7171

7272
@Test
7373
public void newlines_are_not_added_to_container_output_with_tty() {
74-
try (GenericContainer<?> container = new GenericContainer<>("alpine:3.13")) {
74+
try (GenericContainer<?> container = new GenericContainer<>("alpine:3.14")) {
7575
container.withCreateContainerCmdModifier(cmd -> {
7676
cmd.withTty(true);
7777
});

core/src/test/java/org/testcontainers/dockerclient/ImagePullTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@ public class ImagePullTest {
1616
public static String[] parameters() {
1717
return new String[] {
1818
"alpine:latest",
19-
"alpine:3.6",
19+
"alpine:3.14",
2020
"alpine", // omitting the tag should work and default to latest
21-
"alpine@sha256:8fd4b76819e1e5baac82bd0a3d03abfe3906e034cc5ee32100d12aaaf3956dc7",
22-
"gliderlabs/alpine:latest",
23-
"gliderlabs/alpine:3.5",
24-
"gliderlabs/alpine@sha256:a19aa4a17a525c97e5a90a0c53a9f3329d2dc61b0a14df5447757a865671c085",
21+
"alpine@sha256:1775bebec23e1f3ce486989bfc9ff3c4e951690df84aa9f926497d82f2ffca9d",
2522
"quay.io/testcontainers/ryuk:latest",
2623
"quay.io/testcontainers/ryuk:0.2.3",
2724
"quay.io/testcontainers/ryuk@sha256:bb5a635cac4bd96c93cc476969ce11dc56436238ec7cd028d0524462f4739dd9",

core/src/test/java/org/testcontainers/junit/DockerfileTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected void configure(BuildImageCmd buildImageCmd) {
4040
super.configure(buildImageCmd);
4141

4242
List<String> dockerfile = Arrays.asList(
43-
"FROM alpine:3.2",
43+
"FROM alpine:3.14",
4444
"RUN echo 'hello from Docker build process'",
4545
"CMD yes"
4646
);
@@ -59,7 +59,7 @@ public void dockerfileBuilderWorks() {
5959
.withFileFromClasspath("test.txt", "mappable-resource/test-resource.txt")
6060
.withFileFromString("folder/someFile.txt", "hello")
6161
.withDockerfileFromBuilder(builder -> builder
62-
.from("alpine:3.2")
62+
.from("alpine:3.14")
6363
.workDir("/app")
6464
.add("test.txt", "test file.txt")
6565
.run("ls", "-la", "/app/test file.txt")
@@ -101,7 +101,7 @@ public int getFileMode() {
101101

102102
})
103103
.withDockerfileFromBuilder(builder -> builder
104-
.from("alpine:3.2")
104+
.from("alpine:3.14")
105105
.copy("someFile.txt", "/someFile.txt")
106106
.cmd("stat -c \"%a\" /someFile.txt")
107107
);

core/src/test/java/org/testcontainers/junit/FixedHostPortContainerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
public class FixedHostPortContainerTest {
2626

27-
private static final String TEST_IMAGE = "alpine:3.2";
27+
private static final String TEST_IMAGE = "alpine:3.14";
2828

2929
/**
3030
* Default http server port (just something different from default)

core/src/test/java/org/testcontainers/junit/ParameterizedDockerfileContainerTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ public ParameterizedDockerfileContainerTest(String baseImage, String expectedVer
3535
@Parameterized.Parameters(name = "{0}")
3636
public static Object[][] data() {
3737
return new Object[][] {
38-
{ "alpine:3.2", "3.2"},
39-
{ "alpine:3.3", "3.3"},
40-
{ "alpine:3.4", "3.4"},
41-
{ "alpine:3.5", "3.5"},
42-
{ "alpine:3.6", "3.6"}
38+
{ "alpine:3.12", "3.12"},
39+
{ "alpine:3.13", "3.13"},
40+
{ "alpine:3.14", "3.14"}
4341
};
4442
}
4543

core/src/test/java/org/testcontainers/utility/DirectoryTarResourceTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void simpleRecursiveFileTest() {
2626
GenericContainer container = new GenericContainer(
2727
new ImageFromDockerfile()
2828
.withDockerfileFromBuilder(builder ->
29-
builder.from("alpine:3.3")
29+
builder.from("alpine:3.14")
3030
.copy("/tmp/foo", "/foo")
3131
.cmd("cat /foo/test/resources/test-recursive-file.txt")
3232
.build()
@@ -45,7 +45,7 @@ public void simpleRecursiveFileWithPermissionTest() {
4545
GenericContainer container = new GenericContainer(
4646
new ImageFromDockerfile()
4747
.withDockerfileFromBuilder(builder ->
48-
builder.from("alpine:3.3")
48+
builder.from("alpine:3.14")
4949
.copy("/tmp/foo", "/foo")
5050
.cmd("ls", "-al", "/")
5151
.build()
@@ -68,7 +68,7 @@ public void simpleRecursiveClasspathResourceTest() {
6868
GenericContainer container = new GenericContainer(
6969
new ImageFromDockerfile()
7070
.withDockerfileFromBuilder(builder ->
71-
builder.from("alpine:3.3")
71+
builder.from("alpine:3.14")
7272
.copy("/tmp/foo", "/foo")
7373
.cmd("ls -lRt /foo")
7474
.build()

0 commit comments

Comments
 (0)