I recently update the version to 1.15.0 due to #3166, and I found that when I use DockerComposeContainer + Dockerfile with a FROM directive w/o tag, testcontainers tries to pull all images (didn't wait for that happens, just saw it pulls several ancient images, see picture below).
Remove all openresty/openresty images locally
docker-compose.ymlversion: '2.1'
services:
nginx:
build:
context: .
dockerfile: Dockerfile.nginx
entrypoint: [ 'bash', '-c', 'sleep 5 && /usr/bin/openresty -c /var/nginx/conf.d/nginx.conf' ]
Dockerfile.nginxFROM openresty/openresty
RUN echo 'whatever'
import java.io.File;
import org.junit.Test;
import org.testcontainers.containers.DockerComposeContainer;
public class Reproduce {
@Test
public void reproduce() {
final DockerComposeContainer compose = new DockerComposeContainer(new File("src/test/java/docker-compose.yml"));
compose.start();
}
}
Run the test codes, the logs keep printing something like this:

and docker images shows that it is pulling all images:
$ docker images | grep openresty
openresty/openresty 1.17.8.2-5-alpine-fat 5a1867b4dc55 7 weeks ago 353MB
openresty/openresty 1.11.2.1-alpine 590e643a8136 4 years ago 44MB
openresty/openresty 1.11.2.1-centos f43d744951d5 4 years ago 374MB
openresty/openresty 1.11.2.1-centos-rpm dfbc7fc2ba3f 4 years ago 226MB
it pulled images 4 years ago, I'm expecting it only pulls the image with tag latest by default, like what it did before upgrading to 1.15.0.
Now I work around this by specifying the tag explicitly:
FROM openresty/openresty:1.17.8.2-5-alpine-fat
This may be a bug in 1.15.0? @rnorth @bsideup
Thanks for reporting. We had a similar bug with non-compose images but thought it was squashed. Please continue to use that workaround (specifying a tag is generally good practice anyway!).
We'll fix this shortly.
Most helpful comment
Thanks for reporting. We had a similar bug with non-compose images but thought it was squashed. Please continue to use that workaround (specifying a tag is generally good practice anyway!).
We'll fix this shortly.